PERF: stop messing with strings that come back from I18n.t
allows better caching
This commit is contained in:
parent
a5e3e9ae2a
commit
a28a0bbeeb
|
@ -69,7 +69,7 @@ module Email
|
|||
|
||||
def body
|
||||
body = @opts[:body]
|
||||
body = I18n.t("#{@opts[:template]}.text_body_template", template_args) if @opts[:template]
|
||||
body = I18n.t("#{@opts[:template]}.text_body_template", template_args).dup if @opts[:template]
|
||||
|
||||
if @opts[:add_unsubscribe_link]
|
||||
body << "\n"
|
||||
|
|
|
@ -16,10 +16,10 @@ module I18n
|
|||
k = [args,config.locale,config.backend.object_id]
|
||||
t = @cache.fetch(k){found=false}
|
||||
unless found
|
||||
t = @cache[k] = translate_no_cache(*args)
|
||||
t = @cache[k] = translate_no_cache(*args).freeze
|
||||
end
|
||||
|
||||
t.dup
|
||||
t
|
||||
end
|
||||
|
||||
alias_method :t, :translate
|
||||
|
|
|
@ -12,6 +12,7 @@ module PrettyText
|
|||
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
|
||||
|
|
|
@ -25,9 +25,9 @@ module SiteContentClassMethods
|
|||
result = ""
|
||||
if site_content.blank?
|
||||
ct = find_content_type(content_type)
|
||||
result = ct.default_content if ct.present?
|
||||
result = ct.default_content.dup if ct.present?
|
||||
else
|
||||
result = site_content.content
|
||||
result = site_content.content.dup
|
||||
end
|
||||
|
||||
result.gsub!(/\%\{[^}]+\}/) do |m|
|
||||
|
|
Loading…
Reference in New Issue