i18n
https://github.com/svenfuchs/i18n
Ruby
Internationalization (i18n) library for Ruby
I18n::Backend::Fallbacks#translate
Overwrites the Base backend translate method so that it will try each locale given by I18n.fallbacks for the given locale. E.g. for the locale :"de-DE" it might try the locales :"de-DE", :de and :en (depends on the fallbacks implementation) until it finds a result with the given options. If it does not find any result for any of the locales it will then throw MissingTranslation as usual. The default option takes precedence over fallback locales only when it's a Symbol. When the default contains a String, Proc or Hash it is evaluated last after all the fallback locales have been tried.
Edit
git clone [email protected]:svenfuchs/i18n.git
cd i18n
open lib/i18n/backend/fallbacks.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-I18n--Backend--Fallbacks-translate-for-pr
# Commit to gitgit add lib/i18n/backend/fallbacks.rbgit commit -m "better docs for I18n::Backend::Fallbacks#translate"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-I18n--Backend--Fallbacks-translate-for-pr
hub pull-request
# Celebrate!