Created
October 30, 2012 09:52
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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