X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/060d6086ca8b1d5791c6116484c1267659bee812..1a46f412197e881c8a71c4cc6ee169917d19a5d7:/app/helpers/application_helper.rb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b28ab7c1a..7dcbe369b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -10,4 +10,32 @@ module ApplicationHelper def atom_link_to(*args) return link_to(image_tag("RSS.gif", :size => "16x16", :border => 0), Hash[*args], { :class => "rsssmall" }); end + + def javascript_strings + js = "" + + js << "\n" + + return js + end + +private + + def javascript_strings_for_key(key) + js = "" + value = t(key) + + if value.is_a?(String) + js << "i18n_strings['#{key}'] = '" << escape_javascript(value) << "';\n" + else + value.each_key do |k| + js << javascript_strings_for_key("#{key}.#{k}") + end + end + + return js + end end