Created
November 13, 2013 17:43
-
-
Save pyro2927/7453213 to your computer and use it in GitHub Desktop.
Copy down Google Translations into COUNTRYCODE.lproj/Localizable.strings
This file contains 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
require "google_drive" | |
session = GoogleDrive.login("EMAIL_ADDRESS", "PASSWORD") | |
# Document key is the value found for the key param in the url | |
# ex: https://docs.google.com/spreadsheet/ccc?key=0Atoge9gLkMCTdHdza2FxTDliakNGamRXV01WYmNUUVE&usp=drive_web | |
# has a key of 0Atoge9gLkMCTdHdza2FxTDliakNGamRXV01WYmNUUVE | |
ws = session.spreadsheet_by_key("DOCUMENT_KEY").worksheets[0] | |
word_indexes = (3..8) # the rows in which your translated words exist | |
english = Array.new | |
# load our english terms | |
word_indexes.each do |index| | |
english << ws[index, 1] | |
end | |
# (2..12) are the columns in which there are other languages listed | |
# if you add more columns w/ languages, expand this out | |
(2..12).each do |column| | |
lang_code = ws[2, column] | |
Dir.mkdir(lang_code + ".lproj") | |
file = File.open("#{lang_code}.lproj/Localizable.strings", "w") | |
word_indexes.each_with_index do |w, index| | |
file.write("\"#{english[index]}\" = \"#{ws[w,column]}\";\n") | |
end | |
file.close | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment