Modify the existing i18n() javascript function to lookup strings in

the javascript i18n array as well as expanding arguments, and make all
lookups go through it.
This commit is contained in:
Tom Hughes 2009-10-02 23:41:19 +00:00
parent 596ab82461
commit f4dba81b64
3 changed files with 11 additions and 9 deletions

View file

@ -15,7 +15,7 @@ module ApplicationHelper
js = ""
js << "<script type='text/javascript'>\n"
js << "rails_i18n = new Array();\n"
js << "i18n_strings = new Array();\n"
js << javascript_strings_for_key("javascripts")
js << "</script>\n"
@ -29,7 +29,7 @@ private
value = t(key)
if value.is_a?(String)
js << "rails_i18n['#{key}'] = '" << escape_javascript(value) << "';\n"
js << "i18n_strings['#{key}'] = '" << escape_javascript(value) << "';\n"
else
value.each_key do |k|
js << javascript_strings_for_key("#{key}.#{k}")