Skip to content

Instantly share code, notes, and snippets.

@edouard
Created August 8, 2012 07:17
Show Gist options
  • Save edouard/3293057 to your computer and use it in GitHub Desktop.
Save edouard/3293057 to your computer and use it in GitHub Desktop.
Output a WebTranslateIt project’s translations to a .yml file
# before using: gem install web_translate_it
require 'web_translate_it'
file = File.new("fr.yml", "w")
file.puts "fr:\n"
WebTranslateIt::Connection.new('api_key') do
puts "Fetching all strings in project..."
WebTranslateIt::String.find_all.each do |string|
puts string.key
translation = string.translation_for("fr")
file.puts " #{string.key}: \"#{translation.text}\"\n"
end
end
file.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment