i18n 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c2f427a87de527a30014666816a5281355600edcd9732d48d0e3f5ed3a2892a
4
- data.tar.gz: 0c833c66aebca3795c3881be183c58bbe85879f767c70bff65cb76dd75356edb
3
+ metadata.gz: '09643c444c40fe98042352f7f3e3e2df08e15ec5bee9f3d658b3e2fdeeb627a7'
4
+ data.tar.gz: b924468907cca779632052d4ec166c79a9fc10f305a4a4f2c7be6ffeef6a5e47
5
5
  SHA512:
6
- metadata.gz: 87c99a7886fbc70684bfa121fa4d6ba36be32d87f6bcc1bc2a804071c8e197f0b6714ff068fda82a982d33cdd7836f7a3566bc4678bc7061f087939031f83458
7
- data.tar.gz: 87a4fd3e214d2426f8a97476bbbed0730486f6f5d86dfc47d72f980058a7a367124f659b12180a9a8d524ce9465a2bbd784e8c41d2d0fa1e82a65028b03e1488
6
+ metadata.gz: 338556073a2c02752c1d3e5e3ba5ed70cb692d814ab05aca5a3d70ef3ee013aa3bb9d5cfc6aecbbd2a93e4732105a4c05c70968ea7f955c169cf69ad97462796
7
+ data.tar.gz: a0a4eff7b73ac32730dae8b77f609c4cc6fca9b6c2f46d81f42d992e10dd8d1467dbc28985b38769f9cab2f6ac1d67e4309eb8a8df65d9fc38baa39b65343f18
@@ -29,7 +29,8 @@ module I18n
29
29
  # translations will be overwritten by new ones only at the deepest
30
30
  # level of the hash.
31
31
  def store_translations(locale, data, options = {})
32
- if I18n.available_locales_initialized? &&
32
+ if I18n.enforce_available_locales &&
33
+ I18n.available_locales_initialized? &&
33
34
  !I18n.available_locales.include?(locale.to_sym) &&
34
35
  !I18n.available_locales.include?(locale.to_s)
35
36
  return data
@@ -1,3 +1,3 @@
1
1
  module I18n
2
- VERSION = "0.9.4"
2
+ VERSION = "0.9.5"
3
3
  end
@@ -70,12 +70,23 @@ class I18nBackendSimpleTest < I18n::TestCase
70
70
  assert_equal Hash[:'en', {:foo => {:bar => 'bar', :baz => 'baz'}}], translations
71
71
  end
72
72
 
73
- test "simple store_translations: do not store translations for locales not explicitly marked as available" do
73
+ test "simple store_translations: do not store translations unavailable locales if enforce_available_locales is true" do
74
+ begin
75
+ I18n.enforce_available_locales = true
76
+ I18n.available_locales = [:en, :es]
77
+ store_translations(:fr, :foo => {:bar => 'barfr', :baz => 'bazfr'})
78
+ store_translations(:es, :foo => {:bar => 'bares', :baz => 'bazes'})
79
+ assert_nil translations[:fr]
80
+ assert_equal Hash[:foo, {:bar => 'bares', :baz => 'bazes'}], translations[:es]
81
+ ensure
82
+ I18n.config.enforce_available_locales = false
83
+ end
84
+ end
85
+
86
+ test "simple store_translations: store translations for unavailable locales if enforce_available_locales is false" do
74
87
  I18n.available_locales = [:en, :es]
75
88
  store_translations(:fr, :foo => {:bar => 'barfr', :baz => 'bazfr'})
76
- store_translations(:es, :foo => {:bar => 'bares', :baz => 'bazes'})
77
- assert_nil translations[:fr]
78
- assert_equal Hash[:foo, {:bar => 'bares', :baz => 'bazes'}], translations[:es]
89
+ assert_equal Hash[:foo, {:bar => 'barfr', :baz => 'bazfr'}], translations[:fr]
79
90
  end
80
91
 
81
92
  # reloading translations
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.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Fuchs
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2018-02-09 00:00:00.000000000 Z
16
+ date: 2018-02-13 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: concurrent-ruby