aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2018-09-06 14:38:26 -0400
committerGitHub <noreply@github.com>2018-09-06 14:38:26 -0400
commit62a0c307545d6caa27b7e102bc193c6c117351c6 (patch)
tree1f795cfc6f1b6e390065a8a263ac8e348daae7f6 /activesupport
parent2de047dbeb88215e1b5b86c1154e7d0f3002f9ba (diff)
parent66614f6b67402ec526a699760d1c21c586834da8 (diff)
downloadrails-62a0c307545d6caa27b7e102bc193c6c117351c6.tar.gz
rails-62a0c307545d6caa27b7e102bc193c6c117351c6.tar.bz2
rails-62a0c307545d6caa27b7e102bc193c6c117351c6.zip
Merge pull request #33574 from lsylvester/change-i18n-defaults-behaviour-to-match-i18n-1.1.0
update I18n fallbacks configuration to be compatible with i18n 1.1.0
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/i18n_railtie.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/i18n_railtie.rb b/activesupport/lib/active_support/i18n_railtie.rb
index 93bde57f6a..c07eb5b569 100644
--- a/activesupport/lib/active_support/i18n_railtie.rb
+++ b/activesupport/lib/active_support/i18n_railtie.rb
@@ -87,9 +87,21 @@ module I18n
when Hash, Array
Array.wrap(fallbacks)
else # TrueClass
- []
+ [I18n.default_locale]
end
+ if args.empty? || args.first.is_a?(Hash)
+ ActiveSupport::Deprecation.warn(<<-MSG.squish)
+ Using I18n fallbacks with an empty `defaults` sets the defaults to
+ include the `default_locale`. This behavior will change in Rails 6.1.
+ If you desire the default local to be included in the defaults, please
+ explicitly configure it with `config.i18n.fallbacks.defaults =
+ [I18n.default_locale]` or `config.i18n.fallbacks = [I18n.default_locale,
+ {...}]`
+ MSG
+ args.unshift I18n.default_locale
+ end
+
I18n.fallbacks = I18n::Locale::Fallbacks.new(*args)
end