Hello community,

here is the log from the commit of package rubygem-i18n for openSUSE:Factory 
checked in at 2018-02-12 10:15:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-i18n (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-i18n.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-i18n"

Mon Feb 12 10:15:30 2018 rev:17 rq:575368 version:0.9.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-i18n/rubygem-i18n.changes        
2017-11-18 00:21:42.510207849 +0100
+++ /work/SRC/openSUSE:Factory/.rubygem-i18n.new/rubygem-i18n.changes   
2018-02-12 10:15:37.756609472 +0100
@@ -1,0 +2,12 @@
+Fri Feb  9 05:30:52 UTC 2018 - factory-a...@kulow.org
+
+- updated to version 0.9.4
+  no changelog found
+
+-------------------------------------------------------------------
+Thu Feb  8 06:08:00 UTC 2018 - co...@suse.com
+
+- updated to version 0.9.3
+  no changelog found
+
+-------------------------------------------------------------------

Old:
----
  i18n-0.9.1.gem

New:
----
  i18n-0.9.4.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-i18n.spec ++++++
--- /var/tmp/diff_new_pack.X7PRap/_old  2018-02-12 10:15:38.500582663 +0100
+++ /var/tmp/diff_new_pack.X7PRap/_new  2018-02-12 10:15:38.504582519 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package rubygem-i18n
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-i18n
-Version:        0.9.1
+Version:        0.9.4
 Release:        0
 %define mod_name i18n
 %define mod_full_name %{mod_name}-%{version}

++++++ i18n-0.9.1.gem -> i18n-0.9.4.gem ++++++
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/gemfiles/Gemfile.rails-3.2.x 
new/gemfiles/Gemfile.rails-3.2.x
--- old/gemfiles/Gemfile.rails-3.2.x    2017-11-03 01:35:51.000000000 +0100
+++ new/gemfiles/Gemfile.rails-3.2.x    2018-02-09 06:19:53.000000000 +0100
@@ -7,3 +7,4 @@
 gem 'test_declarative'
 gem 'rake'
 gem 'minitest'
+gem 'oj'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/gemfiles/Gemfile.rails-4.0.x 
new/gemfiles/Gemfile.rails-4.0.x
--- old/gemfiles/Gemfile.rails-4.0.x    2017-11-03 01:35:51.000000000 +0100
+++ new/gemfiles/Gemfile.rails-4.0.x    2018-02-09 06:19:53.000000000 +0100
@@ -7,3 +7,4 @@
 gem 'test_declarative'
 gem 'rake'
 gem 'minitest'
+gem 'oj'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/gemfiles/Gemfile.rails-4.1.x 
new/gemfiles/Gemfile.rails-4.1.x
--- old/gemfiles/Gemfile.rails-4.1.x    2017-11-03 01:35:51.000000000 +0100
+++ new/gemfiles/Gemfile.rails-4.1.x    2018-02-09 06:19:53.000000000 +0100
@@ -7,3 +7,4 @@
 gem 'test_declarative'
 gem 'rake'
 gem 'minitest'
+gem 'oj'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/gemfiles/Gemfile.rails-4.2.x 
new/gemfiles/Gemfile.rails-4.2.x
--- old/gemfiles/Gemfile.rails-4.2.x    2017-11-03 01:35:51.000000000 +0100
+++ new/gemfiles/Gemfile.rails-4.2.x    2018-02-09 06:19:53.000000000 +0100
@@ -7,3 +7,4 @@
 gem 'test_declarative'
 gem 'rake'
 gem 'minitest'
+gem 'oj'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/gemfiles/Gemfile.rails-5.0.x 
new/gemfiles/Gemfile.rails-5.0.x
--- old/gemfiles/Gemfile.rails-5.0.x    2017-11-03 01:35:51.000000000 +0100
+++ new/gemfiles/Gemfile.rails-5.0.x    2018-02-09 06:19:53.000000000 +0100
@@ -7,3 +7,4 @@
 gem 'test_declarative'
 gem 'rake'
 gem 'minitest'
+gem 'oj'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/gemfiles/Gemfile.rails-5.1.x 
new/gemfiles/Gemfile.rails-5.1.x
--- old/gemfiles/Gemfile.rails-5.1.x    2017-11-03 01:35:51.000000000 +0100
+++ new/gemfiles/Gemfile.rails-5.1.x    2018-02-09 06:19:53.000000000 +0100
@@ -7,3 +7,4 @@
 gem 'test_declarative'
 gem 'rake'
 gem 'minitest'
+gem 'oj'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/gemfiles/Gemfile.rails-master 
new/gemfiles/Gemfile.rails-master
--- old/gemfiles/Gemfile.rails-master   2017-11-03 01:35:51.000000000 +0100
+++ new/gemfiles/Gemfile.rails-master   2018-02-09 06:19:53.000000000 +0100
@@ -7,3 +7,4 @@
 gem 'test_declarative'
 gem 'rake'
 gem 'minitest'
+gem 'oj'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/i18n/backend/base.rb new/lib/i18n/backend/base.rb
--- old/lib/i18n/backend/base.rb        2017-11-03 01:35:51.000000000 +0100
+++ new/lib/i18n/backend/base.rb        2018-02-09 06:19:53.000000000 +0100
@@ -22,7 +22,10 @@
       end
 
       def translate(locale, key, options = {})
+        raise I18n::ArgumentError if (key.is_a?(String) || key.is_a?(Symbol)) 
&& key.empty?
         raise InvalidLocale.new(locale) unless locale
+        return nil if key.nil? && !options.key?(:default)
+
         entry = lookup(locale, key, options[:scope], options) unless key.nil?
 
         if entry.nil? && options.key?(:default)
@@ -31,17 +34,21 @@
           entry = resolve(locale, key, entry, options)
         end
 
-        if entry.nil?
+        count = options[:count]
+
+        if entry.nil? && (subtrees? || !count)
           if (options.key?(:default) && !options[:default].nil?) || 
!options.key?(:default)
             throw(:exception, I18n::MissingTranslation.new(locale, key, 
options))
           end
         end
 
         entry = entry.dup if entry.is_a?(String)
-
-        count = options[:count]
         entry = pluralize(locale, entry, count) if count
 
+        if entry.nil? && !subtrees?
+          throw(:exception, I18n::MissingTranslation.new(locale, key, options))
+        end
+
         deep_interpolation = options[:deep_interpolation]
         values = options.except(*RESERVED_KEYS)
         if values
@@ -94,6 +101,10 @@
           raise NotImplementedError
         end
 
+        def subtrees?
+          true
+        end
+
         # Evaluates defaults.
         # If given subject is an Array, it walks the array and returns the
         # first translation that can be resolved. Otherwise it tries to resolve
@@ -103,7 +114,8 @@
           case subject
           when Array
             subject.each do |item|
-              result = resolve(locale, object, item, options) and return result
+              result = resolve(locale, object, item, options)
+              return result unless result.nil?
             end and nil
           else
             resolve(locale, object, subject, options)
@@ -141,21 +153,29 @@
         def pluralize(locale, entry, count)
           return entry unless entry.is_a?(Hash) && count
 
-          key = :zero if count == 0 && entry.has_key?(:zero)
-          key ||= count == 1 ? :one : :other
+          key = pluralization_key(entry, count)
           raise InvalidPluralizationData.new(entry, count, key) unless 
entry.has_key?(key)
           entry[key]
         end
 
-        # Interpolates values into a given string.
+        # Interpolates values into a given subject.
         #
-        #   interpolate "file %{file} opened by %%{user}", :file => 
'test.txt', :user => 'Mr. X'
+        #   if the given subject is a string then:
+        #   method interpolates "file %{file} opened by %%{user}", :file => 
'test.txt', :user => 'Mr. X'
         #   # => "file test.txt opened by %{user}"
-        def interpolate(locale, string, values = {})
-          if string.is_a?(::String) && !values.empty?
-            I18n.interpolate(string, values)
+        #
+        #   if the given subject is an array then:
+        #   each element of the array is recursively interpolated (until it 
finds a string)
+        #   method interpolates ["yes, %{user}", ["maybe no, %{user}, "no, 
%{user}"]], :user => "bartuz"
+        #   # => "["yes, bartuz",["maybe no, bartuz", "no, bartuz"]]"
+        def interpolate(locale, subject, values = {})
+          return subject if values.empty?
+
+          case subject
+          when ::String then I18n.interpolate(subject, values)
+          when ::Array then subject.map { |element| interpolate(locale, 
element, values) }
           else
-            string
+            subject
           end
         end
 
@@ -225,6 +245,11 @@
             end
           end
         end
+
+        def pluralization_key(entry, count)
+          key = :zero if count == 0 && entry.has_key?(:zero)
+          key ||= count == 1 ? :one : :other
+        end
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/i18n/backend/key_value.rb 
new/lib/i18n/backend/key_value.rb
--- old/lib/i18n/backend/key_value.rb   2017-11-03 01:35:51.000000000 +0100
+++ new/lib/i18n/backend/key_value.rb   2018-02-09 06:19:53.000000000 +0100
@@ -1,7 +1,24 @@
 require 'i18n/backend/base'
-require 'active_support/json'
 
 module I18n
+
+  begin
+    require 'oj'
+    class JSON
+      class << self
+        def encode(value)
+          Oj::Rails.encode(value)
+        end
+        def decode(value)
+          Oj.load(value)
+        end
+      end
+    end
+  rescue LoadError
+    require 'active_support/json'
+    JSON = ActiveSupport::JSON
+  end
+
   module Backend
     # This is a basic backend for key value stores. It receives on
     # initialization the store, which should respond to three methods:
@@ -65,14 +82,14 @@
             case value
             when Hash
               if @subtrees && (old_value = @store[key])
-                old_value = ActiveSupport::JSON.decode(old_value)
+                old_value = JSON.decode(old_value)
                 value = old_value.deep_symbolize_keys.deep_merge!(value) if 
old_value.is_a?(Hash)
               end
             when Proc
               raise "Key-value stores cannot handle procs"
             end
 
-            @store[key] = ActiveSupport::JSON.encode(value) unless 
value.is_a?(Symbol)
+            @store[key] = JSON.encode(value) unless value.is_a?(Symbol)
           end
         end
 
@@ -86,11 +103,71 @@
 
       protected
 
+        def subtrees?
+          @subtrees
+        end
+
         def lookup(locale, key, scope = [], options = {})
           key   = normalize_flat_keys(locale, key, scope, options[:separator])
           value = @store["#{locale}.#{key}"]
-          value = ActiveSupport::JSON.decode(value) if value
-          value.is_a?(Hash) ? value.deep_symbolize_keys : value
+          value = JSON.decode(value) if value
+
+          if value.is_a?(Hash)
+            value.deep_symbolize_keys
+          elsif !value.nil?
+            value
+          elsif !@subtrees
+            SubtreeProxy.new("#{locale}.#{key}", @store)
+          end
+        end
+
+        def pluralize(locale, entry, count)
+          if subtrees?
+            super
+          else
+            key = pluralization_key(entry, count)
+            entry[key]
+          end
+        end
+      end
+
+      class SubtreeProxy
+        def initialize(master_key, store)
+          @master_key = master_key
+          @store = store
+          @subtree = nil
+        end
+
+        def has_key?(key)
+          @subtree && @subtree.has_key?(key) || self[key]
+        end
+
+        def [](key)
+          unless @subtree && value = @subtree[key]
+            value = @store["#{@master_key}.#{key}"]
+            if value
+              value = JSON.decode(value)
+              (@subtree ||= {})[key] = value
+            end
+          end
+          value
+        end
+
+        def is_a?(klass)
+          Hash == klass || super
+        end
+        alias :kind_of? :is_a?
+
+        def instance_of?(klass)
+          Hash == klass || super
+        end
+
+        def nil?
+          @subtree.nil?
+        end
+
+        def inspect
+          @subtree.inspect
         end
       end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/i18n/backend/simple.rb 
new/lib/i18n/backend/simple.rb
--- old/lib/i18n/backend/simple.rb      2017-11-03 01:35:51.000000000 +0100
+++ new/lib/i18n/backend/simple.rb      2018-02-09 06:19:53.000000000 +0100
@@ -29,6 +29,11 @@
         # translations will be overwritten by new ones only at the deepest
         # level of the hash.
         def store_translations(locale, data, options = {})
+          if I18n.available_locales_initialized? &&
+            !I18n.available_locales.include?(locale.to_sym) &&
+            !I18n.available_locales.include?(locale.to_s)
+            return data
+          end
           locale = locale.to_sym
           translations[locale] ||= {}
           data = data.deep_symbolize_keys
@@ -39,7 +44,7 @@
         def available_locales
           init_translations unless initialized?
           translations.inject([]) do |locales, (locale, data)|
-            locales << locale unless (data.keys - [:i18n]).empty?
+            locales << locale unless data.size <= 1 && (data.empty? || 
data.has_key?(:i18n))
             locales
           end
         end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/i18n/config.rb new/lib/i18n/config.rb
--- old/lib/i18n/config.rb      2017-11-03 01:35:51.000000000 +0100
+++ new/lib/i18n/config.rb      2018-02-09 06:19:53.000000000 +0100
@@ -57,6 +57,11 @@
       @@available_locales = nil if @@available_locales.empty?
       @@available_locales_set = nil
     end
+    
+    # Returns true if the available_locales have been initialized
+    def available_locales_initialized?
+      ( !!defined?(@@available_locales) && !!@@available_locales )
+    end
 
     # Clears the available locales set so it can be recomputed again after I18n
     # gets reloaded.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/i18n/tests/defaults.rb 
new/lib/i18n/tests/defaults.rb
--- old/lib/i18n/tests/defaults.rb      2017-11-03 01:35:51.000000000 +0100
+++ new/lib/i18n/tests/defaults.rb      2018-02-09 06:19:53.000000000 +0100
@@ -24,6 +24,10 @@
         assert_equal 'bar', I18n.t(:does_not_exist, :default => 
[:does_not_exist_2, :'foo.bar'])
       end
 
+      test "defaults: given an array as a default with false it returns false" 
do
+        assert_equal false, I18n.t(:does_not_exist, :default => [false])
+      end
+
       test "defaults: given false it returns false" do
         assert_equal false, I18n.t(:does_not_exist, :default => false)
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/i18n/tests/interpolation.rb 
new/lib/i18n/tests/interpolation.rb
--- old/lib/i18n/tests/interpolation.rb 2017-11-03 01:35:51.000000000 +0100
+++ new/lib/i18n/tests/interpolation.rb 2018-02-09 06:19:53.000000000 +0100
@@ -54,6 +54,11 @@
         assert_equal 'Hi Yehuda!', interpolate(:interpolate, :name => 'Yehuda')
       end
 
+      test "interpolation: given an array interpolates each element" do
+        I18n.backend.store_translations(:en, :array_interpolate => ['Hi', 'Mr. 
%{name}', 'or sir %{name}'])
+        assert_equal ['Hi', 'Mr. Bartuz', 'or sir Bartuz'], 
interpolate(:array_interpolate, :name => 'Bartuz')
+      end
+
       test "interpolation: given the translation is in utf-8 it still works" do
         assert_equal 'Häi David!', interpolate(:default => 'Häi %{name}!', 
:name => 'David')
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/i18n/version.rb new/lib/i18n/version.rb
--- old/lib/i18n/version.rb     2017-11-03 01:35:51.000000000 +0100
+++ new/lib/i18n/version.rb     2018-02-09 06:19:53.000000000 +0100
@@ -1,3 +1,3 @@
 module I18n
-  VERSION = "0.9.1"
+  VERSION = "0.9.4"
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/i18n.rb new/lib/i18n.rb
--- old/lib/i18n.rb     2017-11-03 01:35:51.000000000 +0100
+++ new/lib/i18n.rb     2018-02-09 06:19:53.000000000 +0100
@@ -140,10 +140,14 @@
     # called and passed the key and options.
     #
     # E.g. assuming the key <tt>:salutation</tt> resolves to:
-    #   lambda { |key, options| options[:gender] == 'm' ? "Mr. 
%{options[:name]}" : "Mrs. %{options[:name]}" }
+    #   lambda { |key, options| options[:gender] == 'm' ? "Mr. 
#{options[:name]}" : "Mrs. #{options[:name]}" }
     #
     # Then <tt>I18n.t(:salutation, :gender => 'w', :name => 'Smith') will 
result in "Mrs. Smith".
     #
+    # Note that the string returned by lambda will go through string 
interpolation too,
+    # so the following lambda would give the same result:
+    #   lambda { |key, options| options[:gender] == 'm' ? "Mr. %{name}" : 
"Mrs. %{name}" }
+    #
     # It is recommended to use/implement lambdas in an "idempotent" way. E.g. 
when
     # a cache layer is put in front of I18n.translate it will generate a cache 
key
     # from the argument values passed to #translate. Therefor your lambdas 
should
@@ -157,7 +161,6 @@
       handling = options.delete(:throw) && :throw || options.delete(:raise) && 
:raise # TODO deprecate :raise
 
       enforce_available_locales!(locale)
-      raise I18n::ArgumentError if key.is_a?(String) && key.empty?
 
       result = catch(:exception) do
         if key.is_a?(Array)
@@ -293,6 +296,10 @@
       end
     end
 
+    def available_locales_initialized?
+      config.available_locales_initialized?
+    end
+
   private
 
     # Any exceptions thrown in translate will be sent to the 
@@exception_handler
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2017-11-03 01:35:51.000000000 +0100
+++ new/metadata        2018-02-09 06:19:53.000000000 +0100
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: i18n
 version: !ruby/object:Gem::Version
-  version: 0.9.1
+  version: 0.9.4
 platform: ruby
 authors:
 - Sven Fuchs
@@ -13,7 +13,7 @@
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2017-11-03 00:00:00.000000000 Z
+date: 2018-02-09 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: concurrent-ruby
@@ -151,7 +151,7 @@
       version: 1.3.5
 requirements: []
 rubyforge_project: "[none]"
-rubygems_version: 2.6.11
+rubygems_version: 2.7.4
 signing_key: 
 specification_version: 4
 summary: New wave Internationalization support for Ruby
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/backend/chain_test.rb 
new/test/backend/chain_test.rb
--- old/test/backend/chain_test.rb      2017-11-03 01:35:51.000000000 +0100
+++ new/test/backend/chain_test.rb      2018-02-09 06:19:53.000000000 +0100
@@ -13,7 +13,7 @@
     })
     @second = backend(:en => {
       :bar => 'Bar', :formats => {
-        :long => 'long', 
+        :long => 'long',
         :subformats => {:long => 'long'},
       },
       :plural_2 => { :one => 'one' },
@@ -89,3 +89,34 @@
       backend
     end
 end
+
+class I18nBackendChainWithKeyValueTest < I18n::TestCase
+  def setup_backend!(subtrees = true)
+    first = I18n::Backend::KeyValue.new({}, subtrees)
+    first.store_translations(:en, :plural_1 => { :one => '%{count}' })
+
+    second = I18n::Backend::Simple.new
+    second.store_translations(:en, :plural_2 => { :one => 'one' })
+    I18n.backend = I18n::Backend::Chain.new(first, second)
+  end
+
+  test "subtrees enabled: looks up pluralization translations from the first 
chained backend" do
+    setup_backend!
+    assert_equal '1', I18n.t(:plural_1, count: 1)
+  end
+
+  test "subtrees disabled: looks up pluralization translations from the first 
chained backend" do
+    setup_backend!(false)
+    assert_equal '1', I18n.t(:plural_1, count: 1)
+  end
+
+  test "subtrees enabled: looks up translations from the second chained 
backend" do
+    setup_backend!
+    assert_equal 'one', I18n.t(:plural_2, count: 1)
+  end
+
+  test "subtrees disabled: looks up translations from the second chained 
backend" do
+    setup_backend!(false)
+    assert_equal 'one', I18n.t(:plural_2, count: 1)
+  end
+end if I18n::TestCase.key_value?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/backend/key_value_test.rb 
new/test/backend/key_value_test.rb
--- old/test/backend/key_value_test.rb  2017-11-03 01:35:51.000000000 +0100
+++ new/test/backend/key_value_test.rb  2018-02-09 06:19:53.000000000 +0100
@@ -40,4 +40,22 @@
       I18n.t("foo", :raise => true)
     end
   end
+
+  test "subtrees enabled: given incomplete pluralization data it raises 
I18n::InvalidPluralizationData" do
+    setup_backend!
+    store_translations(:en, :bar => { :one => "One" })
+    assert_raise(I18n::InvalidPluralizationData) { I18n.t(:bar, :count => 2) }
+  end
+
+  test "subtrees disabled: given incomplete pluralization data it returns an 
error message" do
+    setup_backend!(false)
+    store_translations(:en, :bar => { :one => "One" })
+    assert_equal "translation missing: en.bar", I18n.t(:bar, :count => 2)
+  end
+
+  test "translate handles subtrees for pluralization" do
+    setup_backend!(false)
+    store_translations(:en, :bar => { :one => "One" })
+    assert_equal("One", I18n.t("bar", :count => 1))
+  end
 end if I18n::TestCase.key_value?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/backend/simple_test.rb 
new/test/backend/simple_test.rb
--- old/test/backend/simple_test.rb     2017-11-03 01:35:51.000000000 +0100
+++ new/test/backend/simple_test.rb     2018-02-09 06:19:53.000000000 +0100
@@ -70,6 +70,14 @@
     assert_equal Hash[:'en', {:foo => {:bar => 'bar', :baz => 'baz'}}], 
translations
   end
 
+  test "simple store_translations: do not store translations for locales not 
explicitly marked as available" do
+    I18n.available_locales = [:en, :es]
+    store_translations(:fr, :foo => {:bar => 'barfr', :baz => 'bazfr'})
+    store_translations(:es, :foo => {:bar => 'bares', :baz => 'bazes'})
+    assert_nil translations[:fr]
+    assert_equal Hash[:foo, {:bar => 'bares', :baz => 'bazes'}], 
translations[:es]
+  end
+
   # reloading translations
 
   test "simple reload_translations: unloads translations" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/i18n_test.rb new/test/i18n_test.rb
--- old/test/i18n_test.rb       2017-11-03 01:35:51.000000000 +0100
+++ new/test/i18n_test.rb       2018-02-09 06:19:53.000000000 +0100
@@ -216,6 +216,22 @@
     assert_raise(I18n::ArgumentError) { I18n.t("") }
   end
 
+  test "translate given an empty symbol as a key raises an 
I18n::ArgumentError" do
+    assert_raise(I18n::ArgumentError) { I18n.t(:"") }
+  end
+
+  test "translate given an array with empty string as a key raises an 
I18n::ArgumentError" do
+    assert_raise(I18n::ArgumentError) { I18n.t(["", :foo]) }
+  end
+
+  test "translate given an empty array as a key returns empty array" do
+    assert_equal [], I18n.t([])
+  end
+
+  test "translate given nil returns nil" do
+    assert_nil I18n.t(nil)
+  end
+
   test "translate given an unavailable locale rases an I18n::InvalidLocale" do
     begin
       I18n.config.enforce_available_locales = true
@@ -405,7 +421,7 @@
       I18n.config.enforce_available_locales = false
     end
   end
-  
+
   test 'I18n.reload! reloads the set of locales that are enforced' do
     begin
       # Clear the backend that affects the available locales and somehow can 
remain
@@ -413,9 +429,9 @@
       # For instance, it contains enough translations to cause a false 
positive with
       # this test when ran with --seed=50992
       I18n.backend = I18n::Backend::Simple.new
-      
+
       assert !I18n.available_locales.include?(:de), "Available locales should 
not include :de at this point"
-      
+
       I18n.enforce_available_locales = true
 
       assert_raise(I18n::InvalidLocale) { I18n.default_locale = :de }
@@ -431,11 +447,11 @@
       store_translations(:en, :foo => 'Foo in :en')
       store_translations(:de, :foo => 'Foo in :de')
       store_translations(:pl, :foo => 'Foo in :pl')
-      
+
       assert I18n.available_locales.include?(:de), ":de should now be allowed"
       assert I18n.available_locales.include?(:en), ":en should now be allowed"
       assert I18n.available_locales.include?(:pl), ":pl should now be allowed"
-      
+
       assert_nothing_raised { I18n.default_locale = I18n.locale = :en }
       assert_nothing_raised { I18n.default_locale = I18n.locale = :de }
       assert_nothing_raised { I18n.default_locale = I18n.locale = :pl }


Reply via email to