i18n-js 3.3.0 → 4.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +4 -0
  3. data/.github/FUNDING.yml +3 -0
  4. data/.github/ISSUE_TEMPLATE/bug_report.md +41 -0
  5. data/.github/ISSUE_TEMPLATE/config.yml +5 -0
  6. data/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
  7. data/.github/PULL_REQUEST_TEMPLATE.md +38 -0
  8. data/.github/dependabot.yml +15 -0
  9. data/.github/workflows/ruby-tests.yml +73 -0
  10. data/.gitignore +13 -7
  11. data/.rubocop.yml +19 -0
  12. data/CHANGELOG.md +47 -410
  13. data/CODE_OF_CONDUCT.md +74 -0
  14. data/CONTRIBUTING.md +79 -0
  15. data/Gemfile +3 -0
  16. data/LICENSE.md +20 -0
  17. data/MIGRATING_FROM_V3_TO_V4.md +192 -0
  18. data/README.md +439 -793
  19. data/Rakefile +10 -20
  20. data/bin/release +81 -0
  21. data/exe/i18n +5 -0
  22. data/i18n-js.gemspec +51 -29
  23. data/lib/guard/i18n-js/templates/Guardfile +10 -0
  24. data/lib/guard/i18n-js/version.rb +13 -0
  25. data/lib/guard/i18n-js.rb +95 -0
  26. data/lib/i18n-js/clean_hash.rb +13 -0
  27. data/lib/i18n-js/cli/check_command.rb +17 -0
  28. data/lib/i18n-js/cli/command.rb +79 -0
  29. data/lib/i18n-js/cli/export_command.rb +95 -0
  30. data/lib/i18n-js/cli/init_command.rb +52 -0
  31. data/lib/i18n-js/cli/lint_scripts_command.rb +159 -0
  32. data/lib/i18n-js/cli/lint_translations_command.rb +157 -0
  33. data/lib/i18n-js/cli/plugins_command.rb +67 -0
  34. data/lib/i18n-js/cli/ui.rb +64 -0
  35. data/lib/i18n-js/cli/version_command.rb +18 -0
  36. data/lib/i18n-js/cli.rb +66 -0
  37. data/lib/i18n-js/embed_fallback_translations_plugin.rb +70 -0
  38. data/lib/i18n-js/export_files_plugin.rb +103 -0
  39. data/lib/i18n-js/lint.js +150645 -0
  40. data/lib/i18n-js/lint.ts +196 -0
  41. data/lib/i18n-js/listen.rb +96 -0
  42. data/lib/i18n-js/plugin.rb +103 -0
  43. data/lib/i18n-js/schema.rb +216 -0
  44. data/lib/i18n-js/sort_hash.rb +12 -0
  45. data/lib/i18n-js/version.rb +5 -0
  46. data/lib/i18n-js.rb +107 -1
  47. data/package.json +5 -20
  48. metadata +153 -182
  49. data/.editorconfig +0 -24
  50. data/.npmignore +0 -27
  51. data/.travis.yml +0 -37
  52. data/Appraisals +0 -36
  53. data/app/assets/javascripts/i18n/filtered.js.erb +0 -23
  54. data/app/assets/javascripts/i18n/shims.js +0 -208
  55. data/app/assets/javascripts/i18n/translations.js +0 -3
  56. data/app/assets/javascripts/i18n.js +0 -1091
  57. data/gemfiles/i18n_0_6.gemfile +0 -7
  58. data/gemfiles/i18n_0_7.gemfile +0 -7
  59. data/gemfiles/i18n_0_8.gemfile +0 -7
  60. data/gemfiles/i18n_0_9.gemfile +0 -7
  61. data/gemfiles/i18n_1_0.gemfile +0 -7
  62. data/gemfiles/i18n_1_1.gemfile +0 -7
  63. data/gemfiles/i18n_1_2.gemfile +0 -7
  64. data/gemfiles/i18n_1_3.gemfile +0 -7
  65. data/gemfiles/i18n_1_4.gemfile +0 -7
  66. data/gemfiles/i18n_1_5.gemfile +0 -7
  67. data/gemfiles/i18n_1_6.gemfile +0 -7
  68. data/lib/i18n/js/dependencies.rb +0 -63
  69. data/lib/i18n/js/engine.rb +0 -87
  70. data/lib/i18n/js/fallback_locales.rb +0 -70
  71. data/lib/i18n/js/formatters/base.rb +0 -23
  72. data/lib/i18n/js/formatters/js.rb +0 -31
  73. data/lib/i18n/js/formatters/json.rb +0 -13
  74. data/lib/i18n/js/middleware.rb +0 -82
  75. data/lib/i18n/js/private/hash_with_symbol_keys.rb +0 -36
  76. data/lib/i18n/js/segment.rb +0 -75
  77. data/lib/i18n/js/utils.rb +0 -65
  78. data/lib/i18n/js/version.rb +0 -7
  79. data/lib/i18n/js.rb +0 -259
  80. data/lib/rails/generators/i18n/js/config/config_generator.rb +0 -19
  81. data/lib/rails/generators/i18n/js/config/templates/i18n-js.yml +0 -27
  82. data/lib/tasks/export.rake +0 -8
  83. data/spec/fixtures/custom_path.yml +0 -5
  84. data/spec/fixtures/default.yml +0 -5
  85. data/spec/fixtures/erb.yml +0 -5
  86. data/spec/fixtures/except_condition.yml +0 -7
  87. data/spec/fixtures/js_export_dir_custom.yml +0 -7
  88. data/spec/fixtures/js_export_dir_none.yml +0 -6
  89. data/spec/fixtures/js_extend_parent.yml +0 -6
  90. data/spec/fixtures/js_extend_segment.yml +0 -6
  91. data/spec/fixtures/js_file_per_locale.yml +0 -7
  92. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_default_locale_symbol.yml +0 -4
  93. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_hash.yml +0 -6
  94. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_locale.yml +0 -4
  95. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_locale_without_fallback_translations.yml +0 -4
  96. data/spec/fixtures/js_file_per_locale_with_fallbacks_enabled.yml +0 -4
  97. data/spec/fixtures/js_file_per_locale_without_fallbacks.yml +0 -4
  98. data/spec/fixtures/js_file_with_namespace_and_pretty_print.yml +0 -7
  99. data/spec/fixtures/js_sort_translation_keys_false.yml +0 -6
  100. data/spec/fixtures/js_sort_translation_keys_true.yml +0 -6
  101. data/spec/fixtures/json_only.yml +0 -18
  102. data/spec/fixtures/locales.yml +0 -95
  103. data/spec/fixtures/merge_plurals.yml +0 -6
  104. data/spec/fixtures/multiple_conditions.yml +0 -7
  105. data/spec/fixtures/multiple_conditions_per_locale.yml +0 -7
  106. data/spec/fixtures/multiple_files.yml +0 -7
  107. data/spec/fixtures/no_config.yml +0 -2
  108. data/spec/fixtures/no_scope.yml +0 -4
  109. data/spec/fixtures/simple_scope.yml +0 -5
  110. data/spec/js/currency.spec.js +0 -62
  111. data/spec/js/current_locale.spec.js +0 -19
  112. data/spec/js/dates.spec.js +0 -275
  113. data/spec/js/defaults.spec.js +0 -31
  114. data/spec/js/extend.spec.js +0 -110
  115. data/spec/js/interpolation.spec.js +0 -124
  116. data/spec/js/jasmine/MIT.LICENSE +0 -20
  117. data/spec/js/jasmine/jasmine-html.js +0 -190
  118. data/spec/js/jasmine/jasmine.css +0 -166
  119. data/spec/js/jasmine/jasmine.js +0 -2476
  120. data/spec/js/jasmine/jasmine_favicon.png +0 -0
  121. data/spec/js/locales.spec.js +0 -31
  122. data/spec/js/localization.spec.js +0 -54
  123. data/spec/js/numbers.spec.js +0 -170
  124. data/spec/js/placeholder.spec.js +0 -24
  125. data/spec/js/pluralization.spec.js +0 -211
  126. data/spec/js/prepare_options.spec.js +0 -41
  127. data/spec/js/require.js +0 -2083
  128. data/spec/js/specs.html +0 -49
  129. data/spec/js/specs_requirejs.html +0 -72
  130. data/spec/js/translate.spec.js +0 -284
  131. data/spec/js/translations.js +0 -163
  132. data/spec/js/utility_functions.spec.js +0 -20
  133. data/spec/ruby/i18n/js/fallback_locales_spec.rb +0 -84
  134. data/spec/ruby/i18n/js/segment_spec.rb +0 -219
  135. data/spec/ruby/i18n/js/utils_spec.rb +0 -106
  136. data/spec/ruby/i18n/js_spec.rb +0 -663
  137. data/spec/spec_helper.rb +0 -79
  138. data/yarn.lock +0 -131
data/CHANGELOG.md CHANGED
@@ -1,426 +1,63 @@
1
- # Change Log
2
- All notable changes to this project will be documented in this file.
3
- This project adheres to [Semantic Versioning](http://semver.org/).
1
+ # Changelog
4
2
 
3
+ <!--
4
+ Prefix your message with one of the following:
5
5
 
6
- ## [Unreleased]
6
+ - [Added] for new features.
7
+ - [Changed] for changes in existing functionality.
8
+ - [Deprecated] for soon-to-be removed features.
9
+ - [Removed] for now removed features.
10
+ - [Fixed] for any bug fixes.
11
+ - [Security] in case of vulnerabilities.
12
+ -->
7
13
 
8
- ### Added
14
+ ## v4.2.3 - Mar 29, 2023
9
15
 
10
- - Nothing
16
+ - [Fixed] Load plugins when running `i18n lint:*` commands.
11
17
 
12
- ### Changed
18
+ ## v4.2.2 - Dec 30, 2022
13
19
 
14
- - Nothing
20
+ - [Changed] Do not re-export files whose contents haven't changed.
21
+ - [Changed] Translations will always be deep sorted.
22
+ - [Fixed] Remove procs from translations before exporting files.
15
23
 
16
- ### Fixed
24
+ ## v4.2.1 - Dec 25, 2022
17
25
 
18
- - Nothing
26
+ - [Changed] Change plugin api to be based on instance methods. This avoids
27
+ having to pass in the config for each and every method. It also allows us
28
+ adding helper methods to the base class.
29
+ - [Fixed] Fix performance issues with embed fallback translations' initial
30
+ implementation.
19
31
 
32
+ ## v4.2.0 - Dec 10, 2022
20
33
 
21
- ## [3.3.0] - 2019-06-06
34
+ - [Added] Add `I18nJS::Plugin.after_export(files:, config:)` method, that's
35
+ called whenever whenever I18nJS finishes exporting files. You can use it to
36
+ further process files, or generate new files based on the exported files.
37
+ - [Added] Bult-in plugin `I18nJS::ExportFilesPlugin`, which allows exporting
38
+ files out of the translations file by using a custom template.
22
39
 
23
- ### Added
40
+ ## v4.1.0 - Dec 09, 2022
24
41
 
25
- - Support for `%P`, `%Z`, and `%l` strftime formats to match Ruby strftime
42
+ - [Added] Parse configuration files as erb.
43
+ - [Changed] `I18n.listen(run_on_start:)` was added to control if files should be
44
+ exported during `I18n.listen`'s boot. The default value is `true`.
45
+ - [Added] Now it's possible to transform translations before exporting them
46
+ using a stable plugin api.
47
+ - [Added] Built-in plugin `I18nJS::EmbedFallbackTranslationsPlugin`, which
48
+ allows embedding missing translations on exported files.
49
+ - [Deprecated] The `i18n check` has been deprecated. Use
50
+ `i18n lint:translations` instead.
51
+ - [Added] Use `i18n lint:scripts` to lint JavaScript/TypeScript.
52
+ - [Fixed] Expand paths passed to `I18nJS.listen(locales_dir:)`.
26
53
 
54
+ ## v4.0.1 - Aug 25, 2022
27
55
 
28
- ## [3.2.3] - 2019-05-24
56
+ - [Fixed] Shell out export to avoid handling I18n reloading heuristics.
57
+ - [Changed] `I18nJS.listen` now accepts a directories list to watch.
58
+ - [Changed] `I18nJS.listen` now accepts
59
+ [listen](https://rubygems.org/gems/listen) options via `:options`.
29
60
 
30
- ### Changed
61
+ ## v4.0.0 - Jul 29, 2022
31
62
 
32
- - Allow rails 6 to be used with this gem
33
- (PR: https://github.com/fnando/i18n-js/pull/536)
34
-
35
-
36
- ## [3.2.2] - 2019-05-09
37
-
38
- ### Fixed
39
-
40
- - [JS] Return invalid date/time input values (null & undefined) as-is
41
- (Commit: https://github.com/fnando/i18n-js/commit/869d1689ed788ff50121de492db354652971c23d)
42
-
43
-
44
- ## [3.2.1] - 2019-01-22
45
-
46
- ### Changed
47
-
48
- - [Ruby] `json_only` option should allow multiple locales.
49
- (PR: https://github.com/fnando/i18n-js/pull/531)
50
- - [Ruby] Simplified and cleaned code related to JS/JSON formatting.
51
- (PR: https://github.com/fnando/i18n-js/pull/531)
52
- - [JS] Use strict value comparison
53
-
54
- ### Fixed
55
-
56
- - [Ruby] Relax `i18n` version requirement back to `>= 0.6.6`
57
- (PR: https://github.com/fnando/i18n-js/pull/530)
58
- - [Ruby] Fix merging of plural keys across locales.
59
- (PR: https://github.com/fnando/i18n-js/pull/472)
60
-
61
-
62
- ## [3.2.0] - 2018-11-16
63
-
64
- ### Added
65
-
66
- - [Ruby] Add option `json_only` to generate translations in JSON
67
- (PR: https://github.com/fnando/i18n-js/pull/524)
68
-
69
- ### Changed
70
-
71
- - [Ruby] Requires `i18n` to be `>= 0.8.0` for CVE-2014-10077
72
-
73
-
74
- ## [3.1.0] - 2018-11-01
75
-
76
- ### Added
77
-
78
- - [Ruby] Add option to allow setting a different I18n backend
79
- (PR: https://github.com/fnando/i18n-js/pull/519)
80
-
81
- ### Fixed
82
-
83
- - [JS] Fix missing translation when pluralizing with default scopes
84
- (PR: https://github.com/fnando/i18n-js/pull/516)
85
-
86
-
87
- ## [3.0.11] - 2018-07-06
88
-
89
- ### Fixed
90
-
91
- - [JS] Fix interpolation for array with non string/null elements
92
- (PR: https://github.com/fnando/i18n-js/pull/505)
93
-
94
-
95
- ## [3.0.10] - 2018-06-21
96
-
97
- ### Fixed
98
-
99
- - [JS] Fix extend method changing keys with `null` to empty objects
100
- (PR: https://github.com/fnando/i18n-js/pull/503)
101
- - [JS] Fix variable name in an internal method
102
- (PR: https://github.com/fnando/i18n-js/pull/501)
103
-
104
-
105
- ## [3.0.9] - 2018-06-21
106
-
107
- ### Fixed
108
-
109
- - [JS] Fix translation array interpolation for array with null
110
-
111
-
112
- ## [3.0.8] - 2018-06-06
113
-
114
- ### Changed
115
-
116
- - [JS] Interpolate translation array too
117
- (PR: https://github.com/fnando/i18n-js/pull/498)
118
-
119
-
120
- ## [3.0.7] - 2018-05-30
121
-
122
- ### Fixed
123
-
124
- - [Ruby] Fix new bug occuring when config file is absent
125
-
126
-
127
- ## [3.0.6] - 2018-05-30
128
-
129
- ### Fixed
130
-
131
- - [Ruby] Make JS `i18n/filtered` depends on i18n-js config too
132
- (PR: https://github.com/fnando/i18n-js/pull/497)
133
-
134
-
135
- ## [3.0.5] - 2018-02-26
136
-
137
- ### Changed
138
-
139
- - [Ruby] Support `I18n` `1.0.x`
140
- (PR: https://github.com/fnando/i18n-js/pull/492)
141
-
142
-
143
- ## [3.0.4] - 2018-01-26
144
-
145
- ### Fixed
146
-
147
- - [Ruby] Fix `JS::Dependencies.using_asset_pipeline?` returning true when sprockets installed but disabled
148
- (PR: https://github.com/fnando/i18n-js/pull/488)
149
-
150
-
151
- ## [3.0.3] - 2018-01-02
152
-
153
- ### Fixed
154
-
155
- - [Ruby] Fix extend method when translations has array values
156
- (PR: https://github.com/fnando/i18n-js/pull/487)
157
-
158
-
159
- ## [3.0.2] - 2017-10-26
160
-
161
- ### Changed
162
-
163
- - [Ruby] Avoid writing new file if a file with same content already exists
164
- (PR: https://github.com/fnando/i18n-js/pull/473)
165
- - [JS] Fix fallback when "3-part" locale like `zh-Hant-TW` is used
166
- It was falling back to `zh` first instead of `zh-Hant` (see new test case added)
167
- (PR: https://github.com/fnando/i18n-js/pull/475)
168
-
169
-
170
- ## [3.0.1] - 2017-08-02
171
-
172
- ### Changed
173
-
174
- - [Ruby] Relax Rails detection code to work with alternative installation methods
175
- (PR: https://github.com/fnando/i18n-js/pull/467)
176
- - [JS] Fix fallback when "3-part" locale like `zh-Hant-TW` is used
177
- It fallbacks to `zh` only before, now it fallbacks to `zh-Hant`
178
- (PR: https://github.com/fnando/i18n-js/pull/465)
179
-
180
-
181
- ## [3.0.0] - 2017-04-01
182
-
183
- This is a fake official release, the *real* one will be `3.0.0.rc17`
184
- And today is not April Fools' Day
185
-
186
- ### Fixed
187
-
188
- - Ends the longest Release Candidate period among all ruby gems
189
- (v3.0.0.rc1 released at 2012-05-10)
190
-
191
-
192
- ## [3.0.0.rc16] - 2017-03-13
193
-
194
- ### Changed
195
-
196
- - [Ruby] Drop support for Ruby < `2.1.0`
197
-
198
- ### Fixed
199
-
200
- - [JS] Make defaultValue works on plural translation
201
- - [JS] Fix UMD pattern so the global/root won’t be undefined
202
-
203
-
204
- ## [3.0.0.rc15] - 2016-12-07
205
-
206
- ### Added
207
-
208
- - Nothing
209
-
210
- ### Changed
211
-
212
- - [JS] Allow `defaultValue` to work in pluralization
213
- (PR: https://github.com/fnando/i18n-js/pull/433)
214
- - [Ruby] Stop validating the fallback locales against `I18n.available_locales`
215
- This allows some locales to be used as fallback locales, but not to be generated in JS.
216
- (PR: https://github.com/fnando/i18n-js/pull/425)
217
- - [Ruby] Remove dependency on gem `activesupport`
218
-
219
- ### Fixed
220
-
221
- - [JS] Stop converting numeric & boolean values into objects
222
- when merging objects with `I18n.extend`
223
- (PR: https://github.com/fnando/i18n-js/pull/420)
224
- - [JS] Fix I18n pluralization fallback when tree is empty
225
- (PR: https://github.com/fnando/i18n-js/pull/435)
226
- - [Ruby] Use old syntax to define lambda for compatibility with older Rubies
227
- (Issue: https://github.com/fnando/i18n-js/issues/419)
228
- - [Ruby] Fix error raised in middleware cache cleaning in parallel test
229
- (Issue: https://github.com/fnando/i18n-js/issues/436)
230
-
231
-
232
- ## [3.0.0.rc14] - 2016-08-29
233
-
234
- ### Changed
235
-
236
- - [JS] Method `I18n.extend()` behave as deep merging instead of shallow merging. (https://github.com/fnando/i18n-js/pull/416)
237
- - [Ruby] Use object/class instead of block when registering Sprockets preprocessor (https://github.com/fnando/i18n-js/pull/418)
238
- To ensure that your cache will expire properly based on locale file content after upgrading,
239
- you should run `rake assets:clobber` and/or other rake tasks that clear the asset cache once gem updated
240
- - [Ruby] Detect & support rails 5 (https://github.com/fnando/i18n-js/pull/413)
241
-
242
-
243
- ## [3.0.0.rc13] - 2016-06-29
244
-
245
- ### Added
246
-
247
- - [Ruby] Added option `js_extend` to not generate JS code for translations with usage of `I18n.extend` ([#397](https://github.com/fnando/i18n-js/pull/397))
248
-
249
- ### Changed
250
-
251
- - Nothing
252
-
253
- ### Fixed
254
-
255
- - [JS] Initialize option `missingBehaviour` & `missingTranslationPrefix` with default values ([#398](https://github.com/fnando/i18n-js/pull/398))
256
- - [JS] Throw an error when `I18n.strftime()` takes an invalid date ([#383](https://github.com/fnando/i18n-js/pull/383))
257
- - [JS] Fix default error message when translation missing to consider locale passed in options
258
- - [Ruby] Reset middleware cache on rails startup
259
- ([#402](https://github.com/fnando/i18n-js/pull/402))
260
-
261
-
262
- ## [3.0.0.rc12] - 2015-12-30
263
-
264
- ### Added
265
-
266
- - [JS] Allow extending of translation files ([#354](https://github.com/fnando/i18n-js/pull/354))
267
- - [JS] Allow missingPlaceholder to receive extra data for debugging ([#380](https://github.com/fnando/i18n-js/pull/380))
268
-
269
- ### Changed
270
-
271
- - Nothing
272
-
273
- ### Fixed
274
-
275
- - [Ruby] Fix of missing initializer at sprockets. ([#371](https://github.com/fnando/i18n-js/pull/371))
276
- - [Ruby] Use proper method to register preprocessor documented by sprockets-rails. ([#376](https://github.com/fnando/i18n-js/pull/376))
277
- - [JS] Correctly round unprecise floating point numbers.
278
- - [JS] Ensure objects are recognized when passed in from an iframe. ([#375](https://github.com/fnando/i18n-js/pull/375))
279
-
280
-
281
- ## 3.0.0.rc11
282
-
283
- ### breaking changes
284
-
285
- ### enhancements
286
-
287
- ### bug fixes
288
-
289
- - [Ruby] Handle fallback locale without any translation properly ([#338](https://github.com/fnando/i18n-js/pull/338))
290
- - [Ruby] Prevent translation entry with null value to override value in fallback locale(s), if enabled ([#334](https://github.com/fnando/i18n-js/pull/334))
291
-
292
-
293
- ## 3.0.0.rc10
294
-
295
- ### breaking changes
296
-
297
- - [Ruby] In `config/i18n-js.yml`, if you are using `%{locale}` in your filename and are referencing specific translations keys, please add `*.` to the beginning of those keys. ([#320](https://github.com/fnando/i18n-js/pull/320))
298
- - [Ruby] The `:except` option to exclude certain phrases now (only) accepts the same patterns the `:only` option accepts
299
-
300
- ### enhancements
301
-
302
- - [Ruby] Make handling of per-locale and not-per-locale exporting to be more consistent ([#320](https://github.com/fnando/i18n-js/pull/320))
303
- - [Ruby] Add option `sort_translation_keys` to sort translation keys alphabetically ([#318](https://github.com/fnando/i18n-js/pull/318))
304
-
305
- ### bug fixes
306
-
307
- - [Ruby] Fix fallback logic to work with not-per-locale files ([#320](https://github.com/fnando/i18n-js/pull/320))
308
-
309
-
310
- ## 3.0.0.rc9
311
-
312
- ### enhancements
313
-
314
- - [JS] Force currency number sign to be at first place using `sign_first` option, default to `true`
315
- - [Ruby] Add option `namespace` & `pretty_print` ([#300](https://github.com/fnando/i18n-js/pull/300))
316
- - [Ruby] Add option `export_i18n_js` ([#301](https://github.com/fnando/i18n-js/pull/301))
317
- - [Ruby] Now the gem also detects pre-release versions of `rails`
318
- - [Ruby] Add `:except` option to exclude certain phrases or groups of phrases from the
319
- outputted translations ([#312](https://github.com/fnando/i18n-js/pull/312))
320
- - [JS] You can now set `I18n.missingBehavior='guess'` to have the scope string output as text instead of of the
321
- "[missing `scope`]" message when no translation is available.
322
- Combined that with `I18n.missingTranslationPrefix='SOMETHING'` and you can
323
- still identify those missing strings.
324
- ([#304](https://github.com/fnando/i18n-js/pull/304))
325
-
326
- ### bug fixes
327
-
328
- - [JS] Fix missing translation message when scope is passed in options
329
- - [Ruby] Fix save cache directory verification when path is a symbolic link ([#329](https://github.com/fnando/i18n-js/pull/329))
330
-
331
-
332
- ## 3.0.0.rc8
333
-
334
- ### enhancements
335
-
336
- - Add support for loading via AMD and CommonJS module loaders ([#266](https://github.com/fnando/i18n-js/pull/266))
337
- - Add `I18n.nullPlaceholder`
338
- Defaults to I18n.missingPlaceholder (`[missing {{name}} value]`)
339
- Set to `function() {return "";}` to match Ruby `I18n.t("name: %{name}", name: nil)`
340
- - For date formatting, you can now also add placeholders to the date format, see README for detail
341
- - Add fallbacks option to `i18n-js.yml`, defaults to `true`
342
-
343
- ### bug fixes
344
-
345
- - Fix factory initialization so that the Node/CommonJS branch only gets executed if the environment is Node/CommonJS
346
- (it currently will execute if module is defined in the global scope, which occurs with QUnit, for example)
347
- - Fix pluralization rules selection for negative `count` (e.g. `-1` was lead to use `one` for pluralization) ([#268](https://github.com/fnando/i18n-js/pull/268))
348
- - Remove check for `Rails.configuration.assets.compile` before telling Sprockets the dependency of translations JS file
349
- This might be the reason of many "cache not expired" issues
350
- Discovered/reported in #277
351
-
352
- ## 3.0.0.rc7
353
-
354
- ### enhancements
355
-
356
- - The Rails Engine initializer is now named as `i18n-js.register_preprocessor` (https://github.com/fnando/i18n-js/pull/261)
357
- - Rename `I18n::JS.config_file` to `I18n::JS.config_file_path` and make it configurable
358
- Expected a `String`, default is still `config/i18n-js.yml`
359
- - When running `rake i18n:js:export`, the `i18n.js` will also be exported to `I18n::JS.export_i18n_js_dir_path` by default
360
- - Add `I18n::JS.export_i18n_js_dir_path`
361
- Expected a `String`, default is `public/javascripts`
362
- Set to `nil` will disable exporting `i18n.js`
363
-
364
- ### bug fixes
365
-
366
- - Prevent toString() call on `undefined` when there is a missing interpolation value
367
- - Added support for Rails instances without Sprockets object (https://github.com/fnando/i18n-js/pull/241)
368
- - Fix `DEFAULT_OPTIONS` in `i18n.js` which contained an excessive comma
369
- - Fix `nil` values are exported into JS files which causes strange translation error
370
- - Fix pattern to replace all escaped $ in I18n.translate
371
- - Fix JS `I18n.lookup` modifies existing locales accidentally
372
-
373
- ## 3.0.0.rc6
374
-
375
- ### enhancements
376
-
377
- - You can now assign `I18n.locale` & `I18n.default_locale` before loading `i18n.js` in `application.html.*`
378
- (merged to `i18n-js-pika` already)
379
- - You can include ERB in `config/i18n-js.yml`(https://github.com/fnando/i18n-js/pull/224)
380
- - Add support for +00:00 style time zone designator (https://github.com/fnando/i18n-js/pull/167)
381
- - Add back rake task for export (`rake i18n:js:export`)
382
- - Not overriding translation when manually run `I18n::JS.export` (https://github.com/fnando/i18n-js/pull/171)
383
- - Move missing placeholder text generation into its own function (for easier debugging) (https://github.com/fnando/i18n-js/pull/169)
384
- - Add support for milliseconds (`lll` in `yyyy-mm-ddThh:mm:ss.lllZ`) (https://github.com/fnando/i18n-js/pull/192)
385
- - Add back i18n-js.yml config file generator : `rails generate i18n:js:config` (https://github.com/fnando/i18n-js/pull/225)
386
-
387
- ### bug fixes
388
-
389
- - `I18n::JS.export` no longer exports locales other than those in `I18n.available_locales`, if `I18n.available_locales` is set
390
- - I18.t supports the base scope through the options argument
391
- - I18.t accepts an array as the scope
392
- - Fix regression: asset not being reloaded in development when translation changed
393
- - Requires `i18n` to be `~> 0.6`, `0.5` does not work at all
394
- - Fix using multi-star scope with top-level translation key (https://github.com/fnando/i18n-js/pull/221)
395
-
396
-
397
- ## Before 3.0.0.rc5
398
-
399
- - Things happened.
400
-
401
-
402
-
403
- [Unreleased]: https://github.com/fnando/i18n-js/compare/v3.3.0...HEAD
404
- [3.3.0]: https://github.com/fnando/i18n-js/compare/v3.2.3...v3.3.0
405
- [3.2.3]: https://github.com/fnando/i18n-js/compare/v3.2.2...v3.2.3
406
- [3.2.2]: https://github.com/fnando/i18n-js/compare/v3.2.1...v3.2.2
407
- [3.2.1]: https://github.com/fnando/i18n-js/compare/v3.2.0...v3.2.1
408
- [3.2.0]: https://github.com/fnando/i18n-js/compare/v3.1.0...v3.2.0
409
- [3.1.0]: https://github.com/fnando/i18n-js/compare/v3.0.11...v3.1.0
410
- [3.0.11]: https://github.com/fnando/i18n-js/compare/v3.0.10...v3.0.11
411
- [3.0.10]: https://github.com/fnando/i18n-js/compare/v3.0.9...v3.0.10
412
- [3.0.9]: https://github.com/fnando/i18n-js/compare/v3.0.8...v3.0.9
413
- [3.0.8]: https://github.com/fnando/i18n-js/compare/v3.0.7...v3.0.8
414
- [3.0.7]: https://github.com/fnando/i18n-js/compare/v3.0.6...v3.0.7
415
- [3.0.6]: https://github.com/fnando/i18n-js/compare/v3.0.5...v3.0.6
416
- [3.0.5]: https://github.com/fnando/i18n-js/compare/v3.0.4...v3.0.5
417
- [3.0.4]: https://github.com/fnando/i18n-js/compare/v3.0.3...v3.0.4
418
- [3.0.3]: https://github.com/fnando/i18n-js/compare/v3.0.2...v3.0.3
419
- [3.0.2]: https://github.com/fnando/i18n-js/compare/v3.0.1...v3.0.2
420
- [3.0.1]: https://github.com/fnando/i18n-js/compare/v3.0.0...v3.0.1
421
- [3.0.0]: https://github.com/fnando/i18n-js/compare/v3.0.0.rc16...v3.0.0
422
- [3.0.0.rc16]: https://github.com/fnando/i18n-js/compare/v3.0.0.rc15...v3.0.0.rc16
423
- [3.0.0.rc15]: https://github.com/fnando/i18n-js/compare/v3.0.0.rc14...v3.0.0.rc15
424
- [3.0.0.rc14]: https://github.com/fnando/i18n-js/compare/v3.0.0.rc13...v3.0.0.rc14
425
- [3.0.0.rc13]: https://github.com/fnando/i18n-js/compare/v3.0.0.rc12...v3.0.0.rc13
426
- [3.0.0.rc12]: https://github.com/fnando/i18n-js/compare/v3.0.0.rc11...v3.0.0.rc12
63
+ - Official release of i18n-js v4.0.0.
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at me@fnando.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,79 @@
1
+ # Contributing to i18n-js
2
+
3
+ 👍🎉 First off, thanks for taking the time to contribute! 🎉👍
4
+
5
+ The following is a set of guidelines for contributing to this project. These are
6
+ mostly guidelines, not rules. Use your best judgment, and feel free to propose
7
+ changes to this document in a pull request.
8
+
9
+ ## Code of Conduct
10
+
11
+ Everyone interacting in this project's codebases, issue trackers, chat rooms and
12
+ mailing lists is expected to follow the [code of conduct](https://github.com/fnando/i18n-js/blob/main/CODE_OF_CONDUCT.md).
13
+
14
+ ## Reporting bugs
15
+
16
+ This section guides you through submitting a bug report. Following these
17
+ guidelines helps maintainers and the community understand your report, reproduce
18
+ the behavior, and find related reports.
19
+
20
+ - Before creating bug reports, please check the open issues; somebody may
21
+ already have submitted something similar, and you may not need to create a new
22
+ one.
23
+ - When you are creating a bug report, please include as many details as
24
+ possible, with an example reproducing the issue.
25
+
26
+ ## Contributing with code
27
+
28
+ Before making any radicals changes, please make sure you discuss your intention
29
+ by [opening an issue on Github](https://github.com/fnando/i18n-js/issues).
30
+
31
+ When you're ready to make your pull request, follow checklist below to make sure
32
+ your contribution is according to how this project works.
33
+
34
+ 1. [Fork](https://help.github.com/forking/) i18n-js
35
+ 2. Create a topic branch - `git checkout -b my_branch`
36
+ 3. Make your changes using [descriptive commit messages](#commit-messages)
37
+ 4. Update CHANGELOG.md describing your changes by adding an entry to the
38
+ "Unreleased" section. If this section is not available, create one right
39
+ before the last version.
40
+ 5. Push to your branch - `git push origin my_branch`
41
+ 6. [Create a pull request](https://help.github.com/articles/creating-a-pull-request)
42
+ 7. That's it!
43
+
44
+ ## Styleguides
45
+
46
+ ### Commit messages
47
+
48
+ - Use the present tense ("Add feature" not "Added feature")
49
+ - Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
50
+ - Limit the first line to 72 characters or less
51
+ - Reference issues and pull requests liberally after the first line
52
+
53
+ ### Changelog
54
+
55
+ - Add a message describing your changes to the "Unreleased" section. The
56
+ changelog message should follow the same style as the commit message.
57
+ - Prefix your message with one of the following:
58
+ - `[Added]` for new features.
59
+ - `[Changed]` for changes in existing functionality.
60
+ - `[Deprecated]` for soon-to-be removed features.
61
+ - `[Removed]` for now removed features.
62
+ - `[Fixed]` for any bug fixes.
63
+ - `[Security]` in case of vulnerabilities.
64
+
65
+ ### Ruby code
66
+
67
+ - This project uses [Rubocop](https://rubocop.org) to enforce code style. Before
68
+ submitting your changes, make sure your tests are passing and code conforms to
69
+ the expected style by running `rake`.
70
+ - Do not change the library version. This will be done by the maintainer
71
+ whenever a new version is about to be released.
72
+
73
+ ### JavaScript code
74
+
75
+ - This project uses [ESLint](https://eslint.org) to enforce code style. Before
76
+ submitting your changes, make sure your tests are passing and code conforms to
77
+ the expected style by running `yarn test:ci`.
78
+ - Do not change the library version. This will be done by the maintainer
79
+ whenever a new version is about to be released.
data/Gemfile CHANGED
@@ -1,2 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
4
+
2
5
  gemspec
data/LICENSE.md ADDED
@@ -0,0 +1,20 @@
1
+ # The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Nando Vieira
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.