Created
September 23, 2010 03:29
-
-
Save stevenheidel/593036 to your computer and use it in GitHub Desktop.
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
# Go through all the engine's locales | |
Dir["vendor/refinerycms/**/config/locales"].each do |dir| | |
# Open the en and lolcat locales to an array | |
english = IO.readlines(dir + "/en.yml") | |
lolcat = IO.readlines(dir + "/lolcat.yml") | |
english.size.times do |i| | |
# Make sure keys are correct | |
lolcat[i].sub!(/(.*:)/, english[i].match(/(.*:).*/)[1]) rescue nil | |
# Make sure %{variables} are correct | |
lolcat[i].gsub!(/%{.*}/, english[i].match(/%{.*}/)[0]) rescue nil | |
# Make sure <%= codes %> are correct | |
lolcat[i].gsub!(/<%=.*%>/, english[i].match(/<%=.*%>/)[0]) rescue nil | |
end | |
# Write the content back to the lolcat.yml file | |
File.open(dir + "/lolcat.yml", "w") do |file| | |
file.puts(lolcat) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks to http://speaklolcat.com/ for helping with the translation of refinery to lolcat