From 64063f305bae068d5543affe90cf90415b0d3261 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Tue, 13 Mar 2018 10:24:42 +1100 Subject: [PATCH] Describe methods of I18nConfig --- lib/open_food_network/i18n_config.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/open_food_network/i18n_config.rb b/lib/open_food_network/i18n_config.rb index 8ef0b3e563..4e93c9b967 100644 --- a/lib/open_food_network/i18n_config.rb +++ b/lib/open_food_network/i18n_config.rb @@ -3,18 +3,23 @@ module OpenFoodNetwork # Currently, language settings are read from the environment. # See: config/application.yml class I18nConfig + # Locales that can be selected by users. def self.selectable_locales ENV["AVAILABLE_LOCALES"].andand.split(/[\s,]+/) || [] end + # All locales that can be accessed by the application, including fallbacks. def self.available_locales (selectable_locales + [default_locale, 'en']).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 end + # This locale is changed with the code and should always be complete. + # All translations are done from this locale. def self.source_locale "en" end