mirror of
https://github.com/discourse/discourse.git
synced 2026-08-13 06:25:11 -05:00
Merge branch 'master' of github.com:discourse/discourse
This commit is contained in:
@@ -28,6 +28,7 @@ module I18n
|
||||
@overrides_by_site = {}
|
||||
|
||||
reload_no_cache!
|
||||
ensure_all_loaded!
|
||||
end
|
||||
|
||||
LOAD_MUTEX = Mutex.new
|
||||
@@ -105,8 +106,7 @@ module I18n
|
||||
|
||||
by_site = @overrides_by_site[site]
|
||||
|
||||
by_locale = nil
|
||||
unless by_site
|
||||
unless by_site && by_site.has_key?(locale)
|
||||
by_site = @overrides_by_site[site] = {}
|
||||
|
||||
# Load overrides
|
||||
|
||||
@@ -43,7 +43,13 @@ module I18n
|
||||
end
|
||||
|
||||
def search(locale, query)
|
||||
find_results(/#{query}/i, {}, translations[locale])
|
||||
results = {}
|
||||
|
||||
fallbacks(locale).each do |fallback|
|
||||
find_results(/#{query}/i, results, translations[fallback])
|
||||
end
|
||||
|
||||
results
|
||||
end
|
||||
|
||||
protected
|
||||
@@ -54,7 +60,9 @@ module I18n
|
||||
k = k_sym.to_s
|
||||
key_path = path ? "#{path}.#{k}" : k
|
||||
if v.is_a?(String)
|
||||
results[key_path] = v if key_path =~ regexp || v =~ regexp
|
||||
unless results.has_key?(key_path)
|
||||
results[key_path] = v if key_path =~ regexp || v =~ regexp
|
||||
end
|
||||
elsif v.is_a?(Hash)
|
||||
find_results(regexp, results, v, key_path)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user