i18n 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dacd9a4d17f9bead5f815c49595c00d1531ed4d7
4
- data.tar.gz: 1e4d2ba2b94da73f8dbde1957508a849f7162172
3
+ metadata.gz: 74991fa815d721be21fc8f4cb3d10dbe7c069059
4
+ data.tar.gz: 9f325a9e4bc99bc01883448c5871fc13f1eff5a3
5
5
  SHA512:
6
- metadata.gz: f59e2cfebd1627b138d763d6b035078729cc62104697189e8781003aeb6537e8682e5f4f0ea0ad68e30f36873d895fdb863d8fca3abece2c48cb229e170ccb92
7
- data.tar.gz: cd5c4bc9940ccfe400eda8696d8d9bf7630da4c4e67f46a0a6be9f799f64a54fb8d2bdcb9c80dfdeeb3dfc9e14f10d1af715d45dc230415e3491c7b6a187d3e6
6
+ metadata.gz: 641844afc32707026b98596528a19fe177fef51e5d681f98db746d1980315c85f864dab53c5390f62f4d143d31b68b75f41b88e780478f0b00bde9e9e6cbf7dc
7
+ data.tar.gz: f62868e06de0b22744316dfcc74d1e928c6263552043bfea8dfbfd985ad660dbdc404e8324d6b5a85dd62d8355935e8cb999a2c21f540fe5fd68725041d05b21
@@ -37,8 +37,7 @@ module I18n
37
37
  def translate(locale, key, options = {})
38
38
  return super unless options.fetch(:fallback, true)
39
39
  return super if options[:fallback_in_progress]
40
- original_default = options[:default]
41
- extract_non_symbol_default!(options)
40
+ default = extract_non_symbol_default!(options) if options[:default]
42
41
 
43
42
  begin
44
43
  options[:fallback_in_progress] = true
@@ -56,7 +55,9 @@ module I18n
56
55
  options.delete(:fallback_in_progress)
57
56
  end
58
57
 
59
- return super(locale, nil, options.merge(:default => original_default)) if options.key?(:default)
58
+ return if options.key?(:default) && options[:default].nil?
59
+
60
+ return super(locale, nil, options.merge(:default => default)) if default
60
61
  throw(:exception, I18n::MissingTranslation.new(locale, key, options))
61
62
  end
62
63
 
@@ -1,6 +1,6 @@
1
1
  class Hash
2
2
  def slice(*keep_keys)
3
- h = self.class.new
3
+ h = {}
4
4
  keep_keys.each { |key| h[key] = fetch(key) if has_key?(key) }
5
5
  h
6
6
  end unless Hash.method_defined?(:slice)
@@ -21,7 +21,7 @@ class Hash
21
21
  MERGER = proc do |key, v1, v2|
22
22
  Hash === v1 && Hash === v2 ? v1.merge(v2, &MERGER) : v2
23
23
  end
24
-
24
+
25
25
  def deep_merge!(data)
26
26
  merge!(data, &MERGER)
27
27
  end unless Hash.method_defined?(:deep_merge!)
@@ -1,3 +1,3 @@
1
1
  module I18n
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
@@ -1,4 +1,5 @@
1
1
  require 'test_helper'
2
+ require 'digest/md5'
2
3
 
3
4
  begin
4
5
  require 'active_support'
@@ -64,6 +64,10 @@ class I18nBackendFallbacksTranslateTest < I18n::TestCase
64
64
  assert_nil I18n.t(:missing_bar, :locale => :'de-DE', :default => nil)
65
65
  end
66
66
 
67
+ test "returns the translation missing message if the default is also missing" do
68
+ assert_equal 'translation missing: de-DE.missing_bar', I18n.t(:missing_bar, :locale => :'de-DE', :default => [:missing_baz])
69
+ end
70
+
67
71
  test "returns the :'de-DE' default :baz translation for a missing :'de-DE' when defaults contains Symbol" do
68
72
  assert_equal 'Baz in :de-DE', I18n.t(:missing_foo, :locale => :'de-DE', :default => [:baz, "Default Bar"])
69
73
  end
@@ -20,12 +20,6 @@ class I18nCoreExtHashInterpolationTest < I18n::TestCase
20
20
  assert_equal expected, hash.slice(:foo, :not_here)
21
21
  end
22
22
 
23
- test "#slice maintains subclasses of Hash" do
24
- klass = Class.new(Hash)
25
- hash = klass[:foo, 'bar', :baz, 'bar']
26
- assert_instance_of klass, hash.slice(:foo)
27
- end
28
-
29
23
  test "#except" do
30
24
  hash = { :foo => 'bar', :baz => 'bar' }
31
25
  expected = { :foo => 'bar' }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Fuchs
@@ -9,10 +9,11 @@ authors:
9
9
  - Matt Aimonetti
10
10
  - Stephan Soller
11
11
  - Saimon Moore
12
+ - Ryan Bigg
12
13
  autorequire:
13
14
  bindir: bin
14
15
  cert_chain: []
15
- date: 2017-10-15 00:00:00.000000000 Z
16
+ date: 2017-11-03 00:00:00.000000000 Z
16
17
  dependencies:
17
18
  - !ruby/object:Gem::Dependency
18
19
  name: concurrent-ruby