Merge pull request #2039 from TracksApp/graceful-fallback-for-missing-i18n-keys

Add a fallback to :other for i18n
This commit is contained in:
Matt Rogers 2016-08-26 21:24:19 -05:00 committed by GitHub
commit 7a898ecd23

View file

@ -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)