Update I18n fallbacks configuration to be compatible with i18n 1.1.0.

This fixes rubygem-railties test suite.
f38
Vít Ondruch 6 years ago
parent 1927503103
commit b451a68ff4

@ -0,0 +1,37 @@
From 66614f6b67402ec526a699760d1c21c586834da8 Mon Sep 17 00:00:00 2001
From: Lachlan Sylvester <lachlan.sylvester@publicisfrontfoot.com.au>
Date: Fri, 10 Aug 2018 14:28:40 +1000
Subject: [PATCH] update I18n fallbacks configuration to be compatible with
i18n 1.1.0
---
activesupport/lib/active_support/i18n_railtie.rb | 14 +++++++++++++-
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 93bde57f6aa6..c07eb5b56986 100644
--- a/activesupport/lib/active_support/i18n_railtie.rb
+++ b/activesupport/lib/active_support/i18n_railtie.rb
@@ -88,9 +88,21 @@ def self.init_fallbacks(fallbacks)
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

@ -3,7 +3,7 @@
Name: rubygem-%{gem_name}
Epoch: 1
Version: 5.2.1
Release: 1%{?dist}
Release: 2%{?dist}
Summary: A support libraries and Ruby core extensions extracted from the Rails framework
License: MIT
URL: http://rubyonrails.org
@ -16,6 +16,10 @@ Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
# git checkout v5.2.1 && tar czvf activesupport-5.2.1-tests.tgz test/
Source1: %{gem_name}-%{version}-tests.tgz
# Update I18n fallbacks configuration to be compatible with i18n 1.1.0.
# https://github.com/rails/rails/pull/33574
Patch0: rubygem-activesupport-5.2.1-update-I18n-fallbacks-configuration.patch
# ruby package has just soft dependency on rubygem({bigdecimal,json}), while
# ActiveSupport always requires them.
Requires: rubygem(bigdecimal)
@ -56,6 +60,8 @@ Documentation for %{name}.
%prep
%setup -q -n %{gem_name}-%{version}
%patch0 -p2
%build
gem build ../%{gem_name}-%{version}.gemspec
@ -103,6 +109,9 @@ popd
%doc %{gem_instdir}/README.rdoc
%changelog
* Wed Nov 14 2018 Vít Ondruch <vondruch@redhat.com> - 1:5.2.1-2
- Update I18n fallbacks configuration to be compatible with i18n 1.1.0.
* Wed Aug 08 2018 Pavel Valena <pvalena@redhat.com> - 1:5.2.1-1
- Update to Active Support 5.2.1.

Loading…
Cancel
Save