Skip to content

Instantly share code, notes, and snippets.

@edouard
Created October 30, 2012 09:52
Show Gist options
  • Save edouard/3979339 to your computer and use it in GitHub Desktop.
Save edouard/3979339 to your computer and use it in GitHub Desktop.
Create a Gettext .po file containing all untranslated strings in a WebTranslateIt project
# before using: gem install web_translate_it
require 'web_translate_it'
file = File.new("pt.po", "w")
api_key = 'your_api_key'
WebTranslateIt::Connection.new(api_key) do
puts "Fetching all untranslated PT strings in project..."
WebTranslateIt::String.find_all({ :status => 'to_translate', :locale => 'pt' }).each do |string|
file.puts "msgid \"#{string.key}\"\n"
file.puts "msgstr \"\""
file.puts ""
end
end
file.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment