From f14945c155e819ec9c36c6789b69bea5f7e9b3c5 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 3 May 2024 15:02:46 +1000 Subject: [PATCH] More realistic test env for translations Most production servers don't use the source locale `en`. Even if the default language is English, they use a local variant like `en_AU` or `en_GB` to customise some of the translations. However the environment is configured, the app should always fallback to `en` if no other translation is available. --- .env | 4 ++-- spec/base_spec_helper.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.env b/.env index 3182c16226..5cdc06d8bd 100644 --- a/.env +++ b/.env @@ -10,10 +10,10 @@ TIMEZONE="Melbourne" DEFAULT_COUNTRY_CODE="AU" # Locale for translation. -LOCALE="en" +LOCALE="en_AU" # For multilingual - ENV doesn't have array so pass it as string with commas -AVAILABLE_LOCALES="en,es" +AVAILABLE_LOCALES="en_AU,es" # Spree zone. CHECKOUT_ZONE="Australia" diff --git a/spec/base_spec_helper.rb b/spec/base_spec_helper.rb index 6a307e9c3c..fcb68b76d6 100644 --- a/spec/base_spec_helper.rb +++ b/spec/base_spec_helper.rb @@ -141,7 +141,7 @@ RSpec.configure do |config| # Reset locale for all specs. config.around(:each) do |example| - I18n.with_locale(:en) { example.run } + I18n.with_locale(:en_AU) { example.run } end # Reset all feature toggles to prevent leaking.