[DRE-commits] [ruby-i18n] 01/01: Add patch
Lucas Nussbaum
lucas at moszumanska.debian.org
Thu May 7 21:00:04 UTC 2015
This is an automated email from the git hooks/post-receive script.
lucas pushed a commit to branch master
in repository ruby-i18n.
commit 2ac387b1846b50c43e44183fdf23f784febcf4dc
Author: Lucas Nussbaum <lucas at debian.org>
Date: Thu May 7 22:48:45 2015 +0200
Add patch
---
debian/changelog | 7 ++-
.../patches/revert-available-locales-cache.patch | 66 ++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 72 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 381b776..e26820f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,11 @@
-ruby-i18n (0.6.11-2) UNRELEASED; urgency=medium
+ruby-i18n (0.6.11-2) unstable; urgency=medium
+ * Team upload.
* Remove myself from Uploaders.
+ * Add patch revert-available-locales-cache.patch.
+ Closes: #770194, #765124
- -- Lucas Nussbaum <lucas at debian.org> Wed, 08 Apr 2015 17:57:28 +0200
+ -- Lucas Nussbaum <lucas at debian.org> Thu, 07 May 2015 22:37:30 +0200
ruby-i18n (0.6.11-1) unstable; urgency=low
diff --git a/debian/patches/revert-available-locales-cache.patch b/debian/patches/revert-available-locales-cache.patch
new file mode 100644
index 0000000..ceb9f49
--- /dev/null
+++ b/debian/patches/revert-available-locales-cache.patch
@@ -0,0 +1,66 @@
+Description: revert caching of available locales
+Author: Lucas Nussbaum <lucas at debian.org>
+Origin: vendor
+Bug: https://github.com/svenfuchs/i18n/issues/315
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=765124
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=770194
+Forwarded: yes
+--- a/lib/i18n.rb
++++ b/lib/i18n.rb
+@@ -274,7 +274,7 @@ module I18n
+ # Returns true when the passed locale, which can be either a String or a
+ # Symbol, is in the list of available locales. Returns false otherwise.
+ def locale_available?(locale)
+- I18n.config.available_locales_set.include?(locale)
++ I18n.available_locales.map(&:to_s).include?(locale.to_s)
+ end
+
+ # Raises an InvalidLocale exception when the passed locale is not available.
+--- a/lib/i18n/config.rb
++++ b/lib/i18n/config.rb
+@@ -41,19 +41,10 @@ module I18n
+ @@available_locales || backend.available_locales
+ end
+
+- # Caches the available locales list as both strings and symbols in a Set, so
+- # that we can have faster lookups to do the available locales enforce check.
+- def available_locales_set #:nodoc:
+- @@available_locales_set ||= available_locales.inject(Set.new) do |set, locale|
+- set << locale.to_s << locale.to_sym
+- end
+- end
+-
+ # Sets the available locales.
+ def available_locales=(locales)
+ @@available_locales = Array(locales).map { |locale| locale.to_sym }
+ @@available_locales = nil if @@available_locales.empty?
+- @@available_locales_set = nil
+ end
+
+ # Returns the current default scope separator. Defaults to '.'
+--- a/test/i18n_test.rb
++++ b/test/i18n_test.rb
+@@ -215,23 +215,6 @@ class I18nTest < I18n::TestCase
+ end
+ end
+
+- test "available_locales can be replaced at runtime" do
+- begin
+- I18n.config.enforce_available_locales = true
+- assert_raise(I18n::InvalidLocale) { I18n.t(:foo, :locale => 'klingon') }
+- old_locales, I18n.config.available_locales = I18n.config.available_locales, [:klingon]
+- I18n.t(:foo, :locale => 'klingon')
+- ensure
+- I18n.config.enforce_available_locales = false
+- I18n.config.available_locales = old_locales
+- end
+- end
+-
+- test "available_locales_set should return a set" do
+- assert_equal Set, I18n.config.available_locales_set.class
+- assert_equal I18n.config.available_locales.size * 2, I18n.config.available_locales_set.size
+- end
+-
+ test "exists? given an existing key will return true" do
+ assert_equal true, I18n.exists?(:currency)
+ end
diff --git a/debian/patches/series b/debian/patches/series
index b8eaff2..7fa6aab 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
+revert-available-locales-cache.patch
strip_bundler.patch
i18n_set.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-i18n.git
More information about the Pkg-ruby-extras-commits
mailing list