From 610c2f9519b081339c98eabb6ca113dd0772cd26 Mon Sep 17 00:00:00 2001 From: Saimon Moore Date: Thu, 19 Oct 2017 13:10:54 +0200 Subject: [PATCH] Ensure `en` is an I18n fallback in all environments Since `en` is considered as the main fallback for all locales ensure that it is present in all environments. Note: Setting `config.i18n.fallbacks` to `true` means use the default locale which means that if a particular instance is not using an `en` based locale (the parent `en` locale is automatically derived as a fallback) then `en` will not be available as a fallback. --- config/environments/development.rb | 2 ++ config/environments/production.rb | 2 +- config/environments/staging.rb | 2 +- config/environments/test.rb | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config/environments/development.rb b/config/environments/development.rb index 200484122a..f8a177076f 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -29,6 +29,8 @@ Openfoodnetwork::Application.configure do # Expands the lines which load the assets config.assets.debug = false + config.i18n.fallbacks = [:en] + # Show emails using Letter Opener config.action_mailer.delivery_method = :letter_opener config.action_mailer.default_url_options = { host: "0.0.0.0:3000" } diff --git a/config/environments/production.rb b/config/environments/production.rb index 229221e118..40224cdfb2 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -56,7 +56,7 @@ Openfoodnetwork::Application.configure do # 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] + config.i18n.fallbacks = true # Send deprecation notices to registered listeners config.active_support.deprecation = :notify diff --git a/config/environments/staging.rb b/config/environments/staging.rb index a55540883d..303d7d2913 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -56,7 +56,7 @@ Openfoodnetwork::Application.configure do # 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 = true + config.i18n.fallbacks = [:en] # Send deprecation notices to registered listeners config.active_support.deprecation = :notify diff --git a/config/environments/test.rb b/config/environments/test.rb index 3a33fd53d7..7ecc7ae3c2 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -36,6 +36,7 @@ Openfoodnetwork::Application.configure do # Tests assume English text on the site. config.i18n.default_locale = "en" config.i18n.available_locales = ['en', 'es'] + config.i18n.fallbacks = [:en] I18n.locale = config.i18n.locale = config.i18n.default_locale # Use SQL instead of Active Record's schema dumper when creating the test database.