lib/tr8n/extensions/action_view_extension.rb in tr8n-3.2.0 vs lib/tr8n/extensions/action_view_extension.rb in tr8n-3.2.1

- old
+ new

@@ -87,11 +87,12 @@ :list => Tr8n::Config.rules_engine[:gender_list_rule], :date => Tr8n::Config.rules_engine[:date_rule] } client_var_name = opts[:client_var_name] || :tr8nProxy - html = [javascript_include_tag("tr8n/tr8n_client_sdk.js")] + html = [] + # html << [javascript_include_tag("tr8n/tr8n_client_sdk.js")] html << "<script>" html << " var #{client_var_name} = new Tr8n.Proxy(#{opts.to_json});" html << " function reloadTranslations() { " html << " #{client_var_name}.initTranslations(true); " html << " } " @@ -99,9 +100,15 @@ html << " return #{client_var_name}.tr(label, description, tokens, options); " html << " } " html << " function trl(label, description, tokens, options) { " html << " return #{client_var_name}.trl(label, description, tokens, options); " html << " } " + + # TODO: check if TML is enabled + html << " Tr8n.Utils.addEvent(window, 'load', function() { " + html << " #{client_var_name}.initTml(); " + html << " }) " + html << "</script>" html.join("\n").html_safe end # translation functions