mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 03:02:46 +08:00
Merge pull request #2839 from Elberet/smf2-import
Fix pretty_text translation helper again, this time for real
This commit is contained in:
commit
f2520939b8
|
@ -8,15 +8,14 @@ module PrettyText
|
||||||
class Helpers
|
class Helpers
|
||||||
|
|
||||||
def t(key, opts)
|
def t(key, opts)
|
||||||
str = I18n.t("js." + key, opts)
|
key = "js." + key
|
||||||
if opts
|
unless opts
|
||||||
# TODO: server localisation has no parity with client should be fixed
|
return I18n.t(key)
|
||||||
str = str.dup
|
else
|
||||||
opts.each do |k,v|
|
str = I18n.t(key, Hash[opts.entries].symbolize_keys).dup
|
||||||
str.gsub!("{{#{k}}}", v)
|
opts.each {|k,v| str.gsub!("{{#{k.to_s}}}", v.to_s) }
|
||||||
end
|
return str
|
||||||
end
|
end
|
||||||
str
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# function here are available to v8
|
# function here are available to v8
|
||||||
|
|
Loading…
Reference in New Issue
Block a user