Rails 5 I18n default_locale and fallback locale
Rails 5.2 allows you to set config.i18n.fallbacks
to control which fallback locale(s) are able to be used. Set it to an array of symbols to control which locales should be used when a translation is not found. When multiple are set, it goes through the array one by one until a transliterate works (or doesn't).
In your case, you'll want the following in your config/application.rb
:
config.i18n.default_locale = :nb
config.i18n.fallbacks = [:en]
This way, if a locale is not specified, it uses the :nb
locale (your default locale). Then, any time a translate fails in any locale, it will try the :en
locale as a fallback.
Note: if none of your fallback locales have a translation for the key you're trying to translate, you'll still get the translation missing error.
For a more complete answer, here's an example with multiple fallbacks. They will be checked in the order specified:
config.i18n.default_locale = :nb
config.i18n.fallbacks = [:en, :es, :de]