mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-31 22:38:49 +01:00
Merge pull request #2039 from TracksApp/graceful-fallback-for-missing-i18n-keys
Add a fallback to :other for i18n
This commit is contained in:
commit
7a898ecd23
1 changed files with 2 additions and 1 deletions
|
|
@ -27,10 +27,11 @@ module I18n::Backend::Pluralization
|
|||
n==1 ? :one : :other # default :en
|
||||
end
|
||||
end
|
||||
key = :other if key == :few && !entry.has_key?(key) #fallback to :other if :few is missing
|
||||
raise InvalidPluralizationData.new(entry, n) unless entry.has_key?(key)
|
||||
entry[key]
|
||||
end
|
||||
end
|
||||
|
||||
I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)
|
||||
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
|
||||
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue