From 73b57a515f650595b21b9f26b4a5a3c9c982691e Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Thu, 5 Dec 2013 12:46:22 +0100 Subject: set `i18n.enforce_available_locales` before `i18n.default_locale`. --- activesupport/CHANGELOG.md | 5 +++++ activesupport/lib/active_support/i18n_railtie.rb | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'activesupport') diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index 2cb44d8371..ea4aaff610 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,3 +1,8 @@ +* Ensure `config.i18n.enforce_available_locales` is set before any other + configuration option. + + *Yves Senn* + * Added `Date#all_week/month/quarter/year` for generating date ranges. *Dmitriy Meremyanin* diff --git a/activesupport/lib/active_support/i18n_railtie.rb b/activesupport/lib/active_support/i18n_railtie.rb index 890dd9380b..dcdea70443 100644 --- a/activesupport/lib/active_support/i18n_railtie.rb +++ b/activesupport/lib/active_support/i18n_railtie.rb @@ -31,6 +31,11 @@ module I18n fallbacks = app.config.i18n.delete(:fallbacks) + if app.config.i18n.has_key?(:enforce_available_locales) + # this option needs to be set before `default_locale=` to work properly. + I18n.enforce_available_locales = app.config.i18n.delete(:enforce_available_locales) + end + app.config.i18n.each do |setting, value| case setting when :railties_load_path -- cgit v1.2.3