Skip to content

Instantly share code, notes, and snippets.

@stevenheidel
Created September 23, 2010 03:29
Show Gist options
  • Save stevenheidel/593036 to your computer and use it in GitHub Desktop.
Save stevenheidel/593036 to your computer and use it in GitHub Desktop.
# 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
@stevenheidel
Copy link
Author

Thanks to http://speaklolcat.com/ for helping with the translation of refinery to lolcat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment