Created
July 8, 2014 01:36
-
-
Save paulmolluzzo/49243f515eccf65ab0d7 to your computer and use it in GitHub Desktop.
Easy Translate
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
#!/usr/bin/ruby | |
require 'easy_translate' | |
EasyTranslate.api_key = '' #Get from google | |
target_path = '' # path to translate | |
Dir.glob(target_path) do |item| | |
next if item == '.' or item == '..' or item == '.svn' | |
contents = "" | |
update = "" | |
File.open(item, "r") do |file| | |
contents += file.read | |
update += EasyTranslate.translate(contents, :from => :russian, :to => :en) | |
end | |
File.open(item, "w"){ } | |
File.open(item, "w") do |file| | |
file.write(update) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment