mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FIX: I18n.exists? should use locale fallbacks
This commit is contained in:
parent
0717517332
commit
825be30844
1 changed files with 17 additions and 0 deletions
17
lib/freedom_patches/i18n_fallbacks.rb
Normal file
17
lib/freedom_patches/i18n_fallbacks.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
module I18n
|
||||
module Backend
|
||||
module Fallbacks
|
||||
def exists?(locale, key)
|
||||
I18n.fallbacks[locale].each do |fallback|
|
||||
begin
|
||||
return true if super(fallback, key)
|
||||
rescue I18n::InvalidLocale
|
||||
# we do nothing when the locale is invalid, as this is a fallback anyways.
|
||||
end
|
||||
end
|
||||
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue