mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 15:20:13 +01:00
Add a fallback to :other for i18n
In most cases, translations don't supply `:few` even though the language may support the construct. Instead of the app blowing up if the translation for `:few` doesn't exist, fall back to `:other` instead.
This commit is contained in:
parent
bd0598ef64
commit
0511ea3a3a
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