From 5166a3d958e8bc304a19b470026bc27b755f38a2 Mon Sep 17 00:00:00 2001 From: Julius Pabrinkis Date: Thu, 8 Jun 2017 22:35:00 +0100 Subject: [PATCH] Add available_locales config feature --- config/application.rb | 1 + config/application.yml.example | 2 ++ 2 files changed, 3 insertions(+) diff --git a/config/application.rb b/config/application.rb index 82191824ca..189170abdd 100644 --- a/config/application.rb +++ b/config/application.rb @@ -71,6 +71,7 @@ module Openfoodnetwork # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] config.i18n.default_locale = ENV["LOCALE"] + config.i18n.available_locales = ENV["AVAILABLE_LOCALES"].andand.split(',').andand.map(&:strip) || [config.i18n.default_locale] I18n.locale = config.i18n.locale = config.i18n.default_locale # Setting this to true causes a performance regression in Rails 3.2.17 diff --git a/config/application.yml.example b/config/application.yml.example index 5b38a6da60..e39f23fb59 100644 --- a/config/application.yml.example +++ b/config/application.yml.example @@ -9,6 +9,8 @@ TIMEZONE: Melbourne DEFAULT_COUNTRY_CODE: AU # Locale for translation. LOCALE: en +# For multilingual - ENV doesn't have array so pass it as string with commas +AVAILABLE_LOCALES: en,es,en-GB # Spree zone. CHECKOUT_ZONE: Australia # Find currency codes at http://en.wikipedia.org/wiki/ISO_4217.