i18n-js 3.4.1 → 3.4.2

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: 8e97276215fc1d53677d4a73d8fa078d476fbb6400047e43b42ea723eb0df22d
4
- data.tar.gz: 496f8b37aeaceed790124ddbe359ac11831aa83b9b61a39ae1634ecff2187837
3
+ metadata.gz: 3c03dc85b58c3951fc22c5a43b7056dadfa3de7c7fd18f42102048c8022561fd
4
+ data.tar.gz: 7a98a5801846bed99166b38cc46baf81cbb24fe9ce37fe31fa966b2082c817f1
5
5
  SHA512:
6
- metadata.gz: 7ee645b6b5040548d97df6dbccdbcb90f3f8093ed361c5e83abd822de102bbcf963778b60bc7c76a31f6ada69afe20c1422a420ff052f37eb816d1ef3a22155e
7
- data.tar.gz: 395386008e73365635030bddb34a6211d0bc7914fd1822184b3a14a92097d3693ee5834a4cca85f41d584f2b7e46ec528b0fc285d63a9fd93925ee3ffe7c5ab5
6
+ metadata.gz: 1425c3275a7a570c83eefed4f774ab11e04233fdbec3974345a63dc26f4fa0e67cb2707b115d2bc23f5f00f197fa0fdae303c1735dcb9c85a82faa52a164b68f
7
+ data.tar.gz: f86982523812cb129fc910d133273834992f42e64eacdd9af9e0195f6edbadc4be5d92d74615e76720ba0c878e74b0d6e348bbb335fed31bd1f54731b5fa0018
@@ -18,6 +18,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
18
18
  - Nothing
19
19
 
20
20
 
21
+ ## [3.4.2] - 2019-11-11
22
+
23
+ ### Fixed
24
+
25
+ - [Ruby] Fix regression introduced in PR #551
26
+ (PR: https://github.com/fnando/i18n-js/pull/555)
27
+
28
+
21
29
  ## [3.4.1] - 2019-11-01
22
30
 
23
31
  ### Fixed
@@ -417,7 +425,8 @@ And today is not April Fools' Day
417
425
 
418
426
 
419
427
 
420
- [Unreleased]: https://github.com/fnando/i18n-js/compare/v3.4.1...HEAD
428
+ [Unreleased]: https://github.com/fnando/i18n-js/compare/v3.4.2...HEAD
429
+ [3.4.1]: https://github.com/fnando/i18n-js/compare/v3.4.1...v3.4.2
421
430
  [3.4.1]: https://github.com/fnando/i18n-js/compare/v3.4.0...v3.4.1
422
431
  [3.4.0]: https://github.com/fnando/i18n-js/compare/v3.3.0...v3.4.0
423
432
  [3.3.0]: https://github.com/fnando/i18n-js/compare/v3.2.3...v3.3.0
@@ -14,10 +14,12 @@ module I18n
14
14
  v1 || v2
15
15
  end
16
16
  MERGER = proc do |_key, v1, v2|
17
- if Hash === v2 && (v2.keys - PLURAL_KEYS).empty?
18
- slice(v2.merge(v1, &PLURAL_MERGER), v2.keys)
19
- elsif Hash === v1 && Hash === v2
20
- v1.merge(v2, &MERGER)
17
+ if Hash === v1 && Hash === v2
18
+ if (v2.keys - PLURAL_KEYS).empty?
19
+ slice(v2.merge(v1, &PLURAL_MERGER), v2.keys)
20
+ else
21
+ v1.merge(v2, &MERGER)
22
+ end
21
23
  else
22
24
  v2 || v1
23
25
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module I18n
4
4
  module JS
5
- VERSION = "3.4.1"
5
+ VERSION = "3.4.2"
6
6
  end
7
7
  end
@@ -1,5 +1,9 @@
1
1
  en:
2
2
  number:
3
+ human:
4
+ decimal_units:
5
+ units:
6
+ million: Million
3
7
  format:
4
8
  separator: "."
5
9
  delimiter: ","
@@ -48,6 +52,15 @@ en:
48
52
  one: Cat
49
53
  other: Cats
50
54
 
55
+ es:
56
+ number:
57
+ human:
58
+ decimal_units:
59
+ units:
60
+ million:
61
+ one: millón
62
+ other: millones
63
+
51
64
  ru:
52
65
  merge_plurals_with_no_overrides:
53
66
  one: кот
@@ -0,0 +1,4 @@
1
+ translations:
2
+ - file: "tmp/i18n-js/millions.js"
3
+ only:
4
+ - "*.number.human.decimal_units.units"
@@ -598,7 +598,7 @@ EOS
598
598
  it "exports with the keys sorted" do
599
599
  expect(subject).to eq <<EOS
600
600
  I18n.translations || (I18n.translations = {});
601
- I18n.translations["en"] = I18n.extend((I18n.translations["en"] || {}), {"admin":{"edit":{"title":"Edit"},"show":{"note":"more details","title":"Show"}},"date":{"abbr_day_names":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"abbr_month_names":[null,"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"day_names":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"formats":{"default":"%Y-%m-%d","long":"%B %d, %Y","short":"%b %d"},"month_names":[null,"January","February","March","April","May","June","July","August","September","October","November","December"]},"fallback_test":"Success","foo":"Foo","merge_plurals":{"one":"Apple","other":"Apples"},"merge_plurals_with_no_overrides":{"one":"Apple","other":"Apples","zero":"No Apple"},"merge_plurals_with_partial_overrides":{"one":"Cat","other":"Cats"},"null_test":"fallback for null","number":{"currency":{"format":{"delimiter":",","format":"%u%n","precision":2,"separator":".","unit":"$"}},"format":{"delimiter":",","precision":3,"separator":"."}},"time":{"am":"am","formats":{"default":"%a, %d %b %Y %H:%M:%S %z","long":"%B %d, %Y %H:%M","short":"%d %b %H:%M"},"pm":"pm"}});
601
+ I18n.translations["en"] = I18n.extend((I18n.translations["en"] || {}), {"admin":{"edit":{"title":"Edit"},"show":{"note":"more details","title":"Show"}},"date":{"abbr_day_names":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"abbr_month_names":[null,"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"day_names":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"formats":{"default":"%Y-%m-%d","long":"%B %d, %Y","short":"%b %d"},"month_names":[null,"January","February","March","April","May","June","July","August","September","October","November","December"]},"fallback_test":"Success","foo":"Foo","merge_plurals":{"one":"Apple","other":"Apples"},"merge_plurals_with_no_overrides":{"one":"Apple","other":"Apples","zero":"No Apple"},"merge_plurals_with_partial_overrides":{"one":"Cat","other":"Cats"},"null_test":"fallback for null","number":{"currency":{"format":{"delimiter":",","format":"%u%n","precision":2,"separator":".","unit":"$"}},"format":{"delimiter":",","precision":3,"separator":"."},"human":{"decimal_units":{"units":{"million":"Million"}}}},"time":{"am":"am","formats":{"default":"%a, %d %b %Y %H:%M:%S %z","long":"%B %d, %Y %H:%M","short":"%d %b %H:%M"},"pm":"pm"}});
602
602
  EOS
603
603
  end
604
604
  end
@@ -610,6 +610,34 @@ EOS
610
610
  stub_const('I18n::JS::DEFAULT_EXPORT_DIR_PATH', temp_path)
611
611
  end
612
612
 
613
+ # https://github.com/fnando/i18n-js/issues/553
614
+ describe "millions" do
615
+ before do
616
+ stub_const('I18n::JS::DEFAULT_EXPORT_DIR_PATH', temp_path)
617
+ end
618
+
619
+ subject do
620
+ File.read(File.join(I18n::JS.export_i18n_js_dir_path, "millions.js"))
621
+ end
622
+
623
+ it "should correctly export millions" do
624
+ set_config "millions.yml"
625
+ I18n::JS.export
626
+ file_should_exist "millions.js"
627
+
628
+ expect(subject).to eq <<EOS
629
+ I18n.translations || (I18n.translations = {});
630
+ I18n.translations[\"de\"] = I18n.extend((I18n.translations[\"de\"] || {}), {\"number\":{\"human\":{\"decimal_units\":{\"units\":{\"million\":\"Million\"}}}}});
631
+ I18n.translations[\"en\"] = I18n.extend((I18n.translations[\"en\"] || {}), {\"number\":{\"human\":{\"decimal_units\":{\"units\":{\"million\":\"Million\"}}}}});
632
+ I18n.translations[\"en-US\"] = I18n.extend((I18n.translations[\"en-US\"] || {}), {\"number\":{\"human\":{\"decimal_units\":{\"units\":{\"million\":\"Million\"}}}}});
633
+ I18n.translations[\"es\"] = I18n.extend((I18n.translations[\"es\"] || {}), {\"number\":{\"human\":{\"decimal_units\":{\"units\":{\"million\":{\"one\":\"millón\",\"other\":\"millones\"}}}}}});
634
+ I18n.translations[\"fr\"] = I18n.extend((I18n.translations[\"fr\"] || {}), {\"number\":{\"human\":{\"decimal_units\":{\"units\":{\"million\":\"Million\"}}}}});
635
+ I18n.translations[\"ja\"] = I18n.extend((I18n.translations[\"ja\"] || {}), {\"number\":{\"human\":{\"decimal_units\":{\"units\":{\"million\":\"Million\"}}}}});
636
+ I18n.translations[\"ru\"] = I18n.extend((I18n.translations[\"ru\"] || {}), {\"number\":{\"human\":{\"decimal_units\":{\"units\":{\"million\":\"Million\"}}}}});
637
+ EOS
638
+ end
639
+ end
640
+
613
641
  it "exports with js_extend option at parent level" do
614
642
  set_config "js_extend_parent.yml"
615
643
  I18n::JS.export
@@ -681,6 +709,7 @@ I18n.translations || (I18n.translations = {});
681
709
  I18n.translations[\"de\"] = I18n.extend((I18n.translations[\"de\"] || {}), {\"merge_plurals_with_no_overrides\":{\"one\":\"Apple\",\"other\":\"Apples\",\"zero\":\"No Apple\"}});
682
710
  I18n.translations[\"en\"] = I18n.extend((I18n.translations[\"en\"] || {}), {\"merge_plurals_with_no_overrides\":{\"one\":\"Apple\",\"other\":\"Apples\",\"zero\":\"No Apple\"}});
683
711
  I18n.translations[\"en-US\"] = I18n.extend((I18n.translations[\"en-US\"] || {}), {\"merge_plurals_with_no_overrides\":{\"one\":\"Apple\",\"other\":\"Apples\",\"zero\":\"No Apple\"}});
712
+ I18n.translations[\"es\"] = I18n.extend((I18n.translations[\"es\"] || {}), {\"merge_plurals_with_no_overrides\":{\"one\":\"Apple\",\"other\":\"Apples\",\"zero\":\"No Apple\"}});
684
713
  I18n.translations[\"fr\"] = I18n.extend((I18n.translations[\"fr\"] || {}), {\"merge_plurals_with_no_overrides\":{\"one\":\"Apple\",\"other\":\"Apples\",\"zero\":\"No Apple\"}});
685
714
  I18n.translations[\"ja\"] = I18n.extend((I18n.translations[\"ja\"] || {}), {\"merge_plurals_with_no_overrides\":{\"one\":\"Apple\",\"other\":\"Apples\",\"zero\":\"No Apple\"}});
686
715
  I18n.translations[\"ru\"] = I18n.extend((I18n.translations[\"ru\"] || {}), {\"merge_plurals_with_no_overrides\":{\"few\":\"кошек\",\"many\":\"кошка\",\"one\":\"кот\",\"other\":\"кошек\"}});
@@ -708,6 +737,7 @@ I18n.translations || (I18n.translations = {});
708
737
  I18n.translations[\"de\"] = I18n.extend((I18n.translations[\"de\"] || {}), {\"merge_plurals_with_partial_overrides\":{\"one\":\"Cat\",\"other\":\"Cats\"}});
709
738
  I18n.translations[\"en\"] = I18n.extend((I18n.translations[\"en\"] || {}), {\"merge_plurals_with_partial_overrides\":{\"one\":\"Cat\",\"other\":\"Cats\"}});
710
739
  I18n.translations[\"en-US\"] = I18n.extend((I18n.translations[\"en-US\"] || {}), {\"merge_plurals_with_partial_overrides\":{\"few\":null,\"many\":null,\"one\":\"Cat\",\"other\":\"Cats\"}});
740
+ I18n.translations[\"es\"] = I18n.extend((I18n.translations[\"es\"] || {}), {\"merge_plurals_with_partial_overrides\":{\"one\":\"Cat\",\"other\":\"Cats\"}});
711
741
  I18n.translations[\"fr\"] = I18n.extend((I18n.translations[\"fr\"] || {}), {\"merge_plurals_with_partial_overrides\":{\"one\":\"Cat\",\"other\":\"Cats\"}});
712
742
  I18n.translations[\"ja\"] = I18n.extend((I18n.translations[\"ja\"] || {}), {\"merge_plurals_with_partial_overrides\":{\"one\":\"Cat\",\"other\":\"Cats\"}});
713
743
  I18n.translations[\"ru\"] = I18n.extend((I18n.translations[\"ru\"] || {}), {\"merge_plurals_with_partial_overrides\":{\"one\":\"Cat\",\"other\":\"Cats\"}});
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-js
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.1
4
+ version: 3.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-01 00:00:00.000000000 Z
11
+ date: 2019-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -167,6 +167,7 @@ files:
167
167
  - spec/fixtures/merge_plurals.yml
168
168
  - spec/fixtures/merge_plurals_with_no_overrides.yml
169
169
  - spec/fixtures/merge_plurals_with_partial_overrides.yml
170
+ - spec/fixtures/millions.yml
170
171
  - spec/fixtures/multiple_conditions.yml
171
172
  - spec/fixtures/multiple_conditions_per_locale.yml
172
173
  - spec/fixtures/multiple_files.yml
@@ -249,6 +250,7 @@ test_files:
249
250
  - spec/fixtures/merge_plurals.yml
250
251
  - spec/fixtures/merge_plurals_with_no_overrides.yml
251
252
  - spec/fixtures/merge_plurals_with_partial_overrides.yml
253
+ - spec/fixtures/millions.yml
252
254
  - spec/fixtures/multiple_conditions.yml
253
255
  - spec/fixtures/multiple_conditions_per_locale.yml
254
256
  - spec/fixtures/multiple_files.yml