mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 02:48:28 +08:00
FEATURE: Admin interface for editing email templates
This commit is contained in:
@ -18,17 +18,6 @@ module I18n
|
||||
super
|
||||
end
|
||||
|
||||
def overrides_for(locale)
|
||||
@overrides ||= {}
|
||||
site_overrides = @overrides[RailsMultisite::ConnectionManagement.current_db] ||= {}
|
||||
|
||||
return site_overrides[locale] if site_overrides[locale]
|
||||
locale_overrides = site_overrides[locale] = {}
|
||||
|
||||
|
||||
locale_overrides
|
||||
end
|
||||
|
||||
# force explicit loading
|
||||
def load_translations(*filenames)
|
||||
unless filenames.empty?
|
||||
@ -40,24 +29,6 @@ module I18n
|
||||
[locale, SiteSetting.default_locale.to_sym, :en].uniq.compact
|
||||
end
|
||||
|
||||
def lookup(locale, key, scope = [], options = {})
|
||||
|
||||
# Support interpolation and pluralization of overrides
|
||||
if options[:overrides]
|
||||
if options[:count]
|
||||
result = {}
|
||||
options[:overrides].each do |k, v|
|
||||
result[k.split('.').last.to_sym] = v if k != key && k.start_with?(key.to_s)
|
||||
end
|
||||
return result if result.size > 0
|
||||
end
|
||||
|
||||
return options[:overrides][key] if options[:overrides][key]
|
||||
end
|
||||
|
||||
super(locale, key, scope, options)
|
||||
end
|
||||
|
||||
def exists?(locale, key)
|
||||
fallbacks(locale).each do |fallback|
|
||||
begin
|
||||
@ -70,6 +41,25 @@ module I18n
|
||||
false
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def lookup(locale, key, scope = [], options = {})
|
||||
# Support interpolation and pluralization of overrides
|
||||
if options[:overrides]
|
||||
if options[:count]
|
||||
result = {}
|
||||
options[:overrides].each do |k, v|
|
||||
result[k.split('.').last.to_sym] = v if k != key && k.start_with?(key.to_s)
|
||||
end
|
||||
return result if result.size > 0
|
||||
end
|
||||
|
||||
return options[:overrides][key] if options[:overrides][key]
|
||||
end
|
||||
|
||||
super(locale, key, scope, options)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user