i18n-js 3.3.0 → 3.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +1 -1
  3. data/.github/FUNDING.yml +3 -0
  4. data/.github/workflows/tests.yaml +106 -0
  5. data/Appraisals +16 -0
  6. data/CHANGELOG.md +153 -4
  7. data/README.md +505 -333
  8. data/app/assets/javascripts/i18n/shims.js +35 -3
  9. data/app/assets/javascripts/i18n.js +37 -33
  10. data/gemfiles/i18n_1_10.gemfile +7 -0
  11. data/gemfiles/i18n_1_7.gemfile +7 -0
  12. data/gemfiles/i18n_1_8.gemfile +7 -0
  13. data/gemfiles/i18n_1_9.gemfile +7 -0
  14. data/i18n-js.gemspec +2 -2
  15. data/i18njs.png +0 -0
  16. data/lib/i18n/js/dependencies.rb +6 -2
  17. data/lib/i18n/js/engine.rb +1 -1
  18. data/lib/i18n/js/formatters/base.rb +3 -1
  19. data/lib/i18n/js/formatters/js.rb +12 -4
  20. data/lib/i18n/js/middleware.rb +1 -1
  21. data/lib/i18n/js/private/config_store.rb +31 -0
  22. data/lib/i18n/js/segment.rb +9 -3
  23. data/lib/i18n/js/utils.rb +34 -8
  24. data/lib/i18n/js/version.rb +1 -1
  25. data/lib/i18n/js.rb +25 -10
  26. data/package.json +2 -2
  27. data/spec/fixtures/js_available_locales_custom.yml +1 -0
  28. data/spec/fixtures/{js_file_with_namespace_and_pretty_print.yml → js_file_with_namespace_prefix_and_pretty_print.yml} +2 -0
  29. data/spec/fixtures/locales.yml +38 -0
  30. data/spec/fixtures/merge_plurals_with_no_overrides.yml +4 -0
  31. data/spec/fixtures/merge_plurals_with_partial_overrides.yml +4 -0
  32. data/spec/fixtures/millions.yml +4 -0
  33. data/spec/js/dates.spec.js +1 -0
  34. data/spec/js/json_parsable.spec.js +14 -0
  35. data/spec/js/localization.spec.js +38 -14
  36. data/spec/js/numbers.spec.js +4 -0
  37. data/spec/js/pluralization.spec.js +19 -2
  38. data/spec/js/require.js +4 -4
  39. data/spec/js/translate.spec.js +68 -48
  40. data/spec/js/translations.js +27 -2
  41. data/spec/ruby/i18n/js/segment_spec.rb +75 -8
  42. data/spec/ruby/i18n/js/utils_spec.rb +32 -0
  43. data/spec/ruby/i18n/js_spec.rb +169 -35
  44. data/spec/spec_helper.rb +1 -0
  45. data/yarn.lock +32 -25
  46. metadata +26 -9
  47. data/.travis.yml +0 -37
data/yarn.lock CHANGED
@@ -13,9 +13,10 @@ brace-expansion@^1.1.7:
13
13
  balanced-match "^1.0.0"
14
14
  concat-map "0.0.1"
15
15
 
16
- coffeescript@>=1.0.1:
17
- version "2.3.1"
18
- resolved "https://registry.yarnpkg.com/coffeescript/-/coffeescript-2.3.1.tgz#a25f69c251d25805c9842e57fc94bfc453ef6aed"
16
+ coffeescript@~1.12.7:
17
+ version "1.12.7"
18
+ resolved "https://registry.yarnpkg.com/coffeescript/-/coffeescript-1.12.7.tgz#e57ee4c4867cf7f606bfc4a0f2d550c0981ddd27"
19
+ integrity sha512-pLXHFxQMPklVoEekowk8b3erNynC+DVJzChxS/LCBBgR6/8AJkHivkm//zbowcfc7BTCAjryuhx6gPqPRfsFoA==
19
20
 
20
21
  concat-map@0.0.1:
21
22
  version "0.0.1"
@@ -50,9 +51,10 @@ globule@^1.0.0:
50
51
  lodash "~4.17.10"
51
52
  minimatch "~3.0.2"
52
53
 
53
- growl@^1.10.2:
54
+ growl@^1.10.5:
54
55
  version "1.10.5"
55
56
  resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e"
57
+ integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==
56
58
 
57
59
  inflight@^1.0.4:
58
60
  version "1.0.6"
@@ -65,24 +67,26 @@ inherits@2:
65
67
  version "2.0.3"
66
68
  resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
67
69
 
68
- jasmine-growl-reporter@~1.0.1:
69
- version "1.0.1"
70
- resolved "https://registry.yarnpkg.com/jasmine-growl-reporter/-/jasmine-growl-reporter-1.0.1.tgz#375306cef1fbf6357ad7913ca0358aa2285d6d39"
70
+ jasmine-growl-reporter@~2.0.0:
71
+ version "2.0.0"
72
+ resolved "https://registry.yarnpkg.com/jasmine-growl-reporter/-/jasmine-growl-reporter-2.0.0.tgz#4943a2481193d66a8a68ee2f38b6c360fb037859"
73
+ integrity sha512-RYwVfPaGgxQQSHDOt6jQ99/KAkFQ/Fiwg/AzBS+uO9A4UhGhxb7hwXaUUSU/Zs0MxBoFNqmIRC+7P4/+5O3lXg==
71
74
  dependencies:
72
- growl "^1.10.2"
75
+ growl "^1.10.5"
73
76
 
74
- jasmine-node@^1.14.5:
75
- version "1.15.0"
76
- resolved "https://registry.yarnpkg.com/jasmine-node/-/jasmine-node-1.15.0.tgz#d5e9a92623c111f55e4b83ff2ab0407ddbc2a5b7"
77
+ jasmine-node@^3.0.0:
78
+ version "3.0.0"
79
+ resolved "https://registry.yarnpkg.com/jasmine-node/-/jasmine-node-3.0.0.tgz#f12b6fdd24633402ec23e8ea6fef6ffbcb464f90"
80
+ integrity sha512-vUa5Q7bQYwHHqi6FlJYndiKqZp+d+c3MKe0QUMwwrC4JRmoRV3zkg0buxB/uQ6qLh0NO34TNstpAnvaZ6xGlAA==
77
81
  dependencies:
78
- coffeescript ">=1.0.1"
82
+ coffeescript "~1.12.7"
79
83
  gaze "~1.1.2"
80
- jasmine-growl-reporter "~1.0.1"
84
+ jasmine-growl-reporter "~2.0.0"
81
85
  jasmine-reporters "~1.0.0"
82
86
  mkdirp "~0.3.5"
83
- requirejs ">=0.27.1"
84
- underscore ">= 1.3.1"
85
- walkdir ">= 0.0.1"
87
+ requirejs "~2.3.6"
88
+ underscore "~1.9.1"
89
+ walkdir "~0.0.12"
86
90
 
87
91
  jasmine-reporters@~1.0.0:
88
92
  version "1.0.2"
@@ -91,8 +95,8 @@ jasmine-reporters@~1.0.0:
91
95
  mkdirp "~0.3.5"
92
96
 
93
97
  lodash@~4.17.10:
94
- version "4.17.10"
95
- resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
98
+ version "4.17.21"
99
+ resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
96
100
 
97
101
  minimatch@^3.0.4, minimatch@~3.0.2:
98
102
  version "3.0.4"
@@ -114,17 +118,20 @@ path-is-absolute@^1.0.0:
114
118
  version "1.0.1"
115
119
  resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
116
120
 
117
- requirejs@>=0.27.1:
118
- version "2.3.5"
119
- resolved "https://registry.yarnpkg.com/requirejs/-/requirejs-2.3.5.tgz#617b9acbbcb336540ef4914d790323a8d4b861b0"
121
+ requirejs@~2.3.6:
122
+ version "2.3.6"
123
+ resolved "https://registry.yarnpkg.com/requirejs/-/requirejs-2.3.6.tgz#e5093d9601c2829251258c0b9445d4d19fa9e7c9"
124
+ integrity sha512-ipEzlWQe6RK3jkzikgCupiTbTvm4S0/CAU5GlgptkN5SO6F3u0UD0K18wy6ErDqiCyP4J4YYe1HuAShvsxePLg==
120
125
 
121
- "underscore@>= 1.3.1":
122
- version "1.9.1"
123
- resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.9.1.tgz#06dce34a0e68a7babc29b365b8e74b8925203961"
126
+ underscore@~1.9.1:
127
+ version "1.9.2"
128
+ resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.9.2.tgz#0c8d6f536d6f378a5af264a72f7bec50feb7cf2f"
129
+ integrity sha512-D39qtimx0c1fI3ya1Lnhk3E9nONswSKhnffBI0gME9C99fYOkNi04xs8K6pePLhvl1frbDemkaBQ5ikWllR2HQ==
124
130
 
125
- "walkdir@>= 0.0.1":
131
+ walkdir@~0.0.12:
126
132
  version "0.0.12"
127
133
  resolved "https://registry.yarnpkg.com/walkdir/-/walkdir-0.0.12.tgz#2f24f1ade64aab1e458591d4442c8868356e9281"
134
+ integrity sha512-HFhaD4mMWPzFSqhpyDG48KDdrjfn409YQuVW7ckZYhW4sE87mYtWifdB/+73RA7+p4s4K18n5Jfx1kHthE1gBw==
128
135
 
129
136
  wrappy@1:
130
137
  version "1.0.2"
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.3.0
4
+ version: 3.9.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-06-06 00:00:00.000000000 Z
11
+ date: 2022-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
33
+ version: '2.3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.0'
40
+ version: '2.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -102,9 +102,10 @@ extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
104
  - ".editorconfig"
105
+ - ".github/FUNDING.yml"
106
+ - ".github/workflows/tests.yaml"
105
107
  - ".gitignore"
106
108
  - ".npmignore"
107
- - ".travis.yml"
108
109
  - Appraisals
109
110
  - CHANGELOG.md
110
111
  - Gemfile
@@ -120,12 +121,17 @@ files:
120
121
  - gemfiles/i18n_0_9.gemfile
121
122
  - gemfiles/i18n_1_0.gemfile
122
123
  - gemfiles/i18n_1_1.gemfile
124
+ - gemfiles/i18n_1_10.gemfile
123
125
  - gemfiles/i18n_1_2.gemfile
124
126
  - gemfiles/i18n_1_3.gemfile
125
127
  - gemfiles/i18n_1_4.gemfile
126
128
  - gemfiles/i18n_1_5.gemfile
127
129
  - gemfiles/i18n_1_6.gemfile
130
+ - gemfiles/i18n_1_7.gemfile
131
+ - gemfiles/i18n_1_8.gemfile
132
+ - gemfiles/i18n_1_9.gemfile
128
133
  - i18n-js.gemspec
134
+ - i18njs.png
129
135
  - lib/i18n-js.rb
130
136
  - lib/i18n/js.rb
131
137
  - lib/i18n/js/dependencies.rb
@@ -135,6 +141,7 @@ files:
135
141
  - lib/i18n/js/formatters/js.rb
136
142
  - lib/i18n/js/formatters/json.rb
137
143
  - lib/i18n/js/middleware.rb
144
+ - lib/i18n/js/private/config_store.rb
138
145
  - lib/i18n/js/private/hash_with_symbol_keys.rb
139
146
  - lib/i18n/js/segment.rb
140
147
  - lib/i18n/js/utils.rb
@@ -147,6 +154,7 @@ files:
147
154
  - spec/fixtures/default.yml
148
155
  - spec/fixtures/erb.yml
149
156
  - spec/fixtures/except_condition.yml
157
+ - spec/fixtures/js_available_locales_custom.yml
150
158
  - spec/fixtures/js_export_dir_custom.yml
151
159
  - spec/fixtures/js_export_dir_none.yml
152
160
  - spec/fixtures/js_extend_parent.yml
@@ -158,12 +166,15 @@ files:
158
166
  - spec/fixtures/js_file_per_locale_with_fallbacks_as_locale_without_fallback_translations.yml
159
167
  - spec/fixtures/js_file_per_locale_with_fallbacks_enabled.yml
160
168
  - spec/fixtures/js_file_per_locale_without_fallbacks.yml
161
- - spec/fixtures/js_file_with_namespace_and_pretty_print.yml
169
+ - spec/fixtures/js_file_with_namespace_prefix_and_pretty_print.yml
162
170
  - spec/fixtures/js_sort_translation_keys_false.yml
163
171
  - spec/fixtures/js_sort_translation_keys_true.yml
164
172
  - spec/fixtures/json_only.yml
165
173
  - spec/fixtures/locales.yml
166
174
  - spec/fixtures/merge_plurals.yml
175
+ - spec/fixtures/merge_plurals_with_no_overrides.yml
176
+ - spec/fixtures/merge_plurals_with_partial_overrides.yml
177
+ - spec/fixtures/millions.yml
167
178
  - spec/fixtures/multiple_conditions.yml
168
179
  - spec/fixtures/multiple_conditions_per_locale.yml
169
180
  - spec/fixtures/multiple_files.yml
@@ -181,6 +192,7 @@ files:
181
192
  - spec/js/jasmine/jasmine.css
182
193
  - spec/js/jasmine/jasmine.js
183
194
  - spec/js/jasmine/jasmine_favicon.png
195
+ - spec/js/json_parsable.spec.js
184
196
  - spec/js/locales.spec.js
185
197
  - spec/js/localization.spec.js
186
198
  - spec/js/numbers.spec.js
@@ -199,7 +211,7 @@ files:
199
211
  - spec/ruby/i18n/js_spec.rb
200
212
  - spec/spec_helper.rb
201
213
  - yarn.lock
202
- homepage: http://rubygems.org/gems/i18n-js
214
+ homepage: https://rubygems.org/gems/i18n-js
203
215
  licenses:
204
216
  - MIT
205
217
  metadata: {}
@@ -218,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
230
  - !ruby/object:Gem::Version
219
231
  version: '0'
220
232
  requirements: []
221
- rubygems_version: 3.0.3
233
+ rubygems_version: 3.3.10
222
234
  signing_key:
223
235
  specification_version: 4
224
236
  summary: It's a small library to provide the Rails I18n translations on the Javascript.
@@ -227,6 +239,7 @@ test_files:
227
239
  - spec/fixtures/default.yml
228
240
  - spec/fixtures/erb.yml
229
241
  - spec/fixtures/except_condition.yml
242
+ - spec/fixtures/js_available_locales_custom.yml
230
243
  - spec/fixtures/js_export_dir_custom.yml
231
244
  - spec/fixtures/js_export_dir_none.yml
232
245
  - spec/fixtures/js_extend_parent.yml
@@ -238,12 +251,15 @@ test_files:
238
251
  - spec/fixtures/js_file_per_locale_with_fallbacks_as_locale_without_fallback_translations.yml
239
252
  - spec/fixtures/js_file_per_locale_with_fallbacks_enabled.yml
240
253
  - spec/fixtures/js_file_per_locale_without_fallbacks.yml
241
- - spec/fixtures/js_file_with_namespace_and_pretty_print.yml
254
+ - spec/fixtures/js_file_with_namespace_prefix_and_pretty_print.yml
242
255
  - spec/fixtures/js_sort_translation_keys_false.yml
243
256
  - spec/fixtures/js_sort_translation_keys_true.yml
244
257
  - spec/fixtures/json_only.yml
245
258
  - spec/fixtures/locales.yml
246
259
  - spec/fixtures/merge_plurals.yml
260
+ - spec/fixtures/merge_plurals_with_no_overrides.yml
261
+ - spec/fixtures/merge_plurals_with_partial_overrides.yml
262
+ - spec/fixtures/millions.yml
247
263
  - spec/fixtures/multiple_conditions.yml
248
264
  - spec/fixtures/multiple_conditions_per_locale.yml
249
265
  - spec/fixtures/multiple_files.yml
@@ -261,6 +277,7 @@ test_files:
261
277
  - spec/js/jasmine/jasmine.css
262
278
  - spec/js/jasmine/jasmine.js
263
279
  - spec/js/jasmine/jasmine_favicon.png
280
+ - spec/js/json_parsable.spec.js
264
281
  - spec/js/locales.spec.js
265
282
  - spec/js/localization.spec.js
266
283
  - spec/js/numbers.spec.js
data/.travis.yml DELETED
@@ -1,37 +0,0 @@
1
- # Send builds to container-based infrastructure
2
- # http://docs.travis-ci.com/user/workers/container-based-infrastructure/
3
- sudo: false
4
- language: ruby
5
- cache:
6
- bundler: true
7
- yarn: true
8
- directories:
9
- - node_modules
10
- rvm:
11
- - 2.3
12
- - 2.4
13
- - 2.5
14
- - 2.6
15
- - ruby-head
16
- before_install:
17
- # Needed to test JS
18
- - yarn install
19
- gemfile:
20
- - gemfiles/i18n_0_6.gemfile
21
- - gemfiles/i18n_0_7.gemfile
22
- - gemfiles/i18n_0_8.gemfile
23
- - gemfiles/i18n_0_9.gemfile
24
- - gemfiles/i18n_1_0.gemfile
25
- - gemfiles/i18n_1_1.gemfile
26
- - gemfiles/i18n_1_2.gemfile
27
- - gemfiles/i18n_1_3.gemfile
28
- - gemfiles/i18n_1_4.gemfile
29
- - gemfiles/i18n_1_5.gemfile
30
- - gemfiles/i18n_1_6.gemfile
31
- matrix:
32
- fast_finish: true
33
- allow_failures:
34
- - rvm: ruby-head
35
- notifications:
36
- webhooks: https://www.travisbuddy.com/
37
- on_success: never