diff --git a/config/application.rb b/config/application.rb index 506430dc1f..f20dfa9010 100644 --- a/config/application.rb +++ b/config/application.rb @@ -161,12 +161,9 @@ module Openfoodnetwork # The default locale is set in the environment. config.i18n.default_locale = OpenFoodNetwork::I18nConfig.default_locale config.i18n.available_locales = OpenFoodNetwork::I18nConfig.available_locales + config.i18n.fallbacks = OpenFoodNetwork::I18nConfig.fallbacks I18n.locale = config.i18n.locale = config.i18n.default_locale - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found) - config.i18n.fallbacks = [:en] - # Calculate digests for locale files so we can know when they change I18nDigests.build_digests config.i18n.available_locales diff --git a/lib/open_food_network/i18n_config.rb b/lib/open_food_network/i18n_config.rb index d0d71d0450..6c132442d5 100644 --- a/lib/open_food_network/i18n_config.rb +++ b/lib/open_food_network/i18n_config.rb @@ -20,6 +20,10 @@ module OpenFoodNetwork (selectable_locales + [default_locale, source_locale]).uniq end + def self.fallbacks + [default_locale, source_locale].uniq + end + # The default locale that is used when the user doesn't have a preference. def self.default_locale ENV["LOCALE"] || ENV["I18N_LOCALE"] || source_locale