From 3198c3333af788b704e67a4df5e23be2ba1d6ccd Mon Sep 17 00:00:00 2001 From: Jens Maier Date: Thu, 2 Oct 2014 18:19:01 +0200 Subject: [PATCH] Fix pretty_text translation helper again, this time for real --- lib/pretty_text.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/pretty_text.rb b/lib/pretty_text.rb index 2cbefe1e378..6a1625b2dfe 100644 --- a/lib/pretty_text.rb +++ b/lib/pretty_text.rb @@ -8,15 +8,14 @@ module PrettyText class Helpers def t(key, opts) - str = I18n.t("js." + key, opts) - if opts - # TODO: server localisation has no parity with client should be fixed - str = str.dup - opts.each do |k,v| - str.gsub!("{{#{k}}}", v) - end + key = "js." + key + unless opts + return I18n.t(key) + else + str = I18n.t(key, Hash[opts.entries].symbolize_keys).dup + opts.each {|k,v| str.gsub!("{{#{k.to_s}}}", v.to_s) } + return str end - str end # function here are available to v8