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.
- checksums.yaml +4 -4
- data/.editorconfig +1 -1
- data/.github/FUNDING.yml +3 -0
- data/.github/workflows/tests.yaml +106 -0
- data/Appraisals +16 -0
- data/CHANGELOG.md +153 -4
- data/README.md +505 -333
- data/app/assets/javascripts/i18n/shims.js +35 -3
- data/app/assets/javascripts/i18n.js +37 -33
- data/gemfiles/i18n_1_10.gemfile +7 -0
- data/gemfiles/i18n_1_7.gemfile +7 -0
- data/gemfiles/i18n_1_8.gemfile +7 -0
- data/gemfiles/i18n_1_9.gemfile +7 -0
- data/i18n-js.gemspec +2 -2
- data/i18njs.png +0 -0
- data/lib/i18n/js/dependencies.rb +6 -2
- data/lib/i18n/js/engine.rb +1 -1
- data/lib/i18n/js/formatters/base.rb +3 -1
- data/lib/i18n/js/formatters/js.rb +12 -4
- data/lib/i18n/js/middleware.rb +1 -1
- data/lib/i18n/js/private/config_store.rb +31 -0
- data/lib/i18n/js/segment.rb +9 -3
- data/lib/i18n/js/utils.rb +34 -8
- data/lib/i18n/js/version.rb +1 -1
- data/lib/i18n/js.rb +25 -10
- data/package.json +2 -2
- data/spec/fixtures/js_available_locales_custom.yml +1 -0
- data/spec/fixtures/{js_file_with_namespace_and_pretty_print.yml → js_file_with_namespace_prefix_and_pretty_print.yml} +2 -0
- data/spec/fixtures/locales.yml +38 -0
- data/spec/fixtures/merge_plurals_with_no_overrides.yml +4 -0
- data/spec/fixtures/merge_plurals_with_partial_overrides.yml +4 -0
- data/spec/fixtures/millions.yml +4 -0
- data/spec/js/dates.spec.js +1 -0
- data/spec/js/json_parsable.spec.js +14 -0
- data/spec/js/localization.spec.js +38 -14
- data/spec/js/numbers.spec.js +4 -0
- data/spec/js/pluralization.spec.js +19 -2
- data/spec/js/require.js +4 -4
- data/spec/js/translate.spec.js +68 -48
- data/spec/js/translations.js +27 -2
- data/spec/ruby/i18n/js/segment_spec.rb +75 -8
- data/spec/ruby/i18n/js/utils_spec.rb +32 -0
- data/spec/ruby/i18n/js_spec.rb +169 -35
- data/spec/spec_helper.rb +1 -0
- data/yarn.lock +32 -25
- metadata +26 -9
- data/.travis.yml +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d3a003954d81c9cbb7c2f18791ed8baf068f3fbbe6587ce59cd893b7852d1f2
|
4
|
+
data.tar.gz: d9fcb2bf3de34987021c2ac556ae65bcecbdfe6cbb638455d6e7919e03268d8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07b6670d05343e82e44041379917a56ee72b185b1bfdcceefe6ae8eae9a1eece1852db7a378eaf8a38f5769ec76587737b200bfb22e50444a02e14bbb4b78793
|
7
|
+
data.tar.gz: afe058283a6af31ab843ba2c0da1f1949d37623a3e0823c786cb947b252eac51ffc25c4f856c01e9e1ec87546dd31dddf4705e1f6b5597a3edd02e950e674ed2
|
data/.editorconfig
CHANGED
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
name: Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
- v3
|
8
|
+
paths-ignore:
|
9
|
+
- 'README.md'
|
10
|
+
push:
|
11
|
+
branches:
|
12
|
+
- main
|
13
|
+
- v3
|
14
|
+
paths-ignore:
|
15
|
+
- 'README.md'
|
16
|
+
|
17
|
+
jobs:
|
18
|
+
ruby_unit_tests:
|
19
|
+
name: Ruby Unit Tests
|
20
|
+
if: "contains(github.event.commits[0].message, '[ci skip]') == false"
|
21
|
+
strategy:
|
22
|
+
fail-fast: false
|
23
|
+
matrix:
|
24
|
+
os:
|
25
|
+
- ubuntu
|
26
|
+
ruby:
|
27
|
+
- 2.4
|
28
|
+
- 2.5
|
29
|
+
- 2.6
|
30
|
+
- 2.7
|
31
|
+
- '3.0'
|
32
|
+
- 3.1
|
33
|
+
gemfile:
|
34
|
+
- gemfiles/i18n_0_6.gemfile
|
35
|
+
- gemfiles/i18n_0_7.gemfile
|
36
|
+
- gemfiles/i18n_0_8.gemfile
|
37
|
+
- gemfiles/i18n_0_9.gemfile
|
38
|
+
- gemfiles/i18n_1_0.gemfile
|
39
|
+
- gemfiles/i18n_1_1.gemfile
|
40
|
+
- gemfiles/i18n_1_2.gemfile
|
41
|
+
- gemfiles/i18n_1_3.gemfile
|
42
|
+
- gemfiles/i18n_1_4.gemfile
|
43
|
+
- gemfiles/i18n_1_5.gemfile
|
44
|
+
- gemfiles/i18n_1_6.gemfile
|
45
|
+
- gemfiles/i18n_1_7.gemfile
|
46
|
+
- gemfiles/i18n_1_8.gemfile
|
47
|
+
- gemfiles/i18n_1_9.gemfile
|
48
|
+
- gemfiles/i18n_1_10.gemfile
|
49
|
+
allow_failures:
|
50
|
+
- false
|
51
|
+
include:
|
52
|
+
- os: ubuntu
|
53
|
+
ruby: ruby-head
|
54
|
+
gemfile: gemfiles/i18n_1_8.gemfile
|
55
|
+
allow_failures: true
|
56
|
+
env:
|
57
|
+
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
|
58
|
+
ALLOW_FAILURES: "${{ matrix.allow_failures }}"
|
59
|
+
runs-on: ${{ matrix.os }}-latest
|
60
|
+
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
|
61
|
+
steps:
|
62
|
+
- name: Checkout
|
63
|
+
uses: actions/checkout@v2
|
64
|
+
- name: Setup Ruby
|
65
|
+
uses: ruby/setup-ruby@v1
|
66
|
+
with:
|
67
|
+
ruby-version: ${{ matrix.ruby }}
|
68
|
+
bundler-cache: true
|
69
|
+
- name: Test
|
70
|
+
run: bundle exec rake spec:ruby || $ALLOW_FAILURES
|
71
|
+
|
72
|
+
js_unit_tests:
|
73
|
+
name: JS Unit Tests
|
74
|
+
if: "contains(github.event.commits[0].message, '[ci skip]') == false"
|
75
|
+
strategy:
|
76
|
+
fail-fast: false
|
77
|
+
matrix:
|
78
|
+
os:
|
79
|
+
- ubuntu
|
80
|
+
node:
|
81
|
+
- 10
|
82
|
+
- 12
|
83
|
+
- 14
|
84
|
+
runs-on: ${{ matrix.os }}-latest
|
85
|
+
steps:
|
86
|
+
- name: Checkout
|
87
|
+
uses: actions/checkout@v2
|
88
|
+
- name: Setup node
|
89
|
+
uses: actions/setup-node@v1
|
90
|
+
with:
|
91
|
+
node-version: ${{ matrix.node }}
|
92
|
+
- name: Get yarn cache directory path
|
93
|
+
id: yarn-cache-dir-path
|
94
|
+
run: echo "::set-output name=dir::$(yarn cache dir)"
|
95
|
+
- uses: actions/cache@v2
|
96
|
+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
97
|
+
with:
|
98
|
+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
99
|
+
key: ${{ runner.os }}-yarn-${{ github.ref }}-${{ github.sha }}
|
100
|
+
restore-keys: |
|
101
|
+
${{ runner.os }}-yarn-${{ github.ref }}-
|
102
|
+
${{ runner.os }}-yarn-
|
103
|
+
- name: Install JS Dependencies
|
104
|
+
run: yarn install
|
105
|
+
- name: Test
|
106
|
+
run: npm test
|
data/Appraisals
CHANGED
@@ -34,3 +34,19 @@ end
|
|
34
34
|
appraise "i18n_1_6" do
|
35
35
|
gem "i18n", "~> 1.6.0"
|
36
36
|
end
|
37
|
+
|
38
|
+
appraise "i18n_1_7" do
|
39
|
+
gem "i18n", "~> 1.7.0"
|
40
|
+
end
|
41
|
+
|
42
|
+
appraise "i18n_1_8" do
|
43
|
+
gem "i18n", "~> 1.8.0"
|
44
|
+
end
|
45
|
+
|
46
|
+
appraise "i18n_1_9" do
|
47
|
+
gem "i18n", "~> 1.9.0"
|
48
|
+
end
|
49
|
+
|
50
|
+
appraise "i18n_1_10" do
|
51
|
+
gem "i18n", "~> 1.10.0"
|
52
|
+
end
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
|
-
This project adheres to [Semantic Versioning](
|
3
|
+
This project adheres to [Semantic Versioning](https://semver.org/).
|
4
4
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
@@ -18,18 +18,151 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
18
18
|
- Nothing
|
19
19
|
|
20
20
|
|
21
|
+
## [3.9.2] - 2022-03-31
|
22
|
+
|
23
|
+
### Fixed
|
24
|
+
|
25
|
+
- [JS] Fix pluralization fallback in i18n.js
|
26
|
+
(PR: https://github.com/fnando/i18n-js/pull/645)
|
27
|
+
|
28
|
+
|
29
|
+
## [3.9.1] - 2022-02-08
|
30
|
+
|
31
|
+
### Changed
|
32
|
+
|
33
|
+
- [Ruby] Allow rails 7
|
34
|
+
(PR: https://github.com/fnando/i18n-js/pull/638)
|
35
|
+
|
36
|
+
|
37
|
+
## [3.9.0] - 2021-07-30
|
38
|
+
|
39
|
+
### Added
|
40
|
+
|
41
|
+
- [Ruby] Allow to set custom locales instead of using only `I18n.available_locales`.
|
42
|
+
(PR: https://github.com/fnando/i18n-js/pull/617)
|
43
|
+
|
44
|
+
|
45
|
+
## [3.8.4] - 2021-07-27
|
46
|
+
|
47
|
+
### Fixed
|
48
|
+
|
49
|
+
- [Ruby] Fix proc exported to JS/JSON file(s) causing issues like git merge conflicts
|
50
|
+
(PR: https://github.com/fnando/i18n-js/pull/591)
|
51
|
+
|
52
|
+
|
53
|
+
## [3.8.3] - 2021-05-21
|
54
|
+
|
55
|
+
### Changed
|
56
|
+
|
57
|
+
- [Ruby] Generate translations in JS as `JSON.parse` instead of object literal for performance
|
58
|
+
(PR: https://github.com/fnando/i18n-js/pull/605)
|
59
|
+
(PR: https://github.com/fnando/i18n-js/pull/606)
|
60
|
+
(PR: https://github.com/fnando/i18n-js/pull/607)
|
61
|
+
|
62
|
+
|
63
|
+
## [3.8.2] - 2021-03-18
|
64
|
+
|
65
|
+
### Fixed
|
66
|
+
|
67
|
+
- [Ruby] Stop using deprecated method
|
68
|
+
(PR: https://github.com/fnando/i18n-js/pull/598)
|
69
|
+
- [Ruby] Fix typo in error class reference
|
70
|
+
(Commit: https://github.com/fnando/i18n-js/commit/cc075ad0a36e940205d0a14390379d69013d188e)
|
71
|
+
|
72
|
+
|
73
|
+
## [3.8.1] - 2021-02-25
|
74
|
+
|
75
|
+
### Fixed
|
76
|
+
|
77
|
+
- [Ruby] Fix performance issue reading config
|
78
|
+
(PR: https://github.com/fnando/i18n-js/pull/593)
|
79
|
+
|
80
|
+
|
81
|
+
## [3.8.0] - 2020-10-15
|
82
|
+
|
83
|
+
### Added
|
84
|
+
|
85
|
+
- [JS] Add option `scope` for `toHumanSize()`
|
86
|
+
(PR: https://github.com/fnando/i18n-js/pull/583)
|
87
|
+
|
88
|
+
|
89
|
+
## [3.7.1] - 2020-06-30
|
90
|
+
|
91
|
+
### Fixed
|
92
|
+
|
93
|
+
- [JS] For translation missing behaviour `guess`, replace all underscores to spaces properly
|
94
|
+
(PR: https://github.com/fnando/i18n-js/pull/574)
|
95
|
+
|
96
|
+
|
97
|
+
## [3.7.0] - 2020-05-29
|
98
|
+
|
99
|
+
### Added
|
100
|
+
|
101
|
+
- [JS] Allow options to be passed in when calling `I18n.localize`/`I18n.l`
|
102
|
+
(PR: https://github.com/fnando/i18n-js/pull/570)
|
103
|
+
|
104
|
+
|
105
|
+
## [3.6.0] - 2020-02-14
|
106
|
+
|
107
|
+
### Added
|
108
|
+
|
109
|
+
- [Ruby] Allow `suffix` to be added to generated translations files
|
110
|
+
(PR: https://github.com/fnando/i18n-js/pull/561)
|
111
|
+
|
112
|
+
|
113
|
+
## [3.5.1] - 2019-12-21
|
114
|
+
|
115
|
+
### Changed
|
116
|
+
|
117
|
+
- [JS] Bound shortcut functions
|
118
|
+
(PR: https://github.com/fnando/i18n-js/pull/560)
|
119
|
+
|
120
|
+
|
121
|
+
## [3.5.0] - 2019-11-12
|
122
|
+
|
123
|
+
### Added
|
124
|
+
|
125
|
+
- [JS] Support for `%k` strftime format to match Ruby strftime
|
126
|
+
(PR: https://github.com/fnando/i18n-js/pull/554)
|
127
|
+
|
128
|
+
|
129
|
+
## [3.4.2] - 2019-11-11
|
130
|
+
|
131
|
+
### Fixed
|
132
|
+
|
133
|
+
- [Ruby] Fix regression introduced in PR #551
|
134
|
+
(PR: https://github.com/fnando/i18n-js/pull/555)
|
135
|
+
|
136
|
+
|
137
|
+
## [3.4.1] - 2019-11-01
|
138
|
+
|
139
|
+
### Fixed
|
140
|
+
|
141
|
+
- [Ruby] Fix merging of plural keys to work with fallbacks that aren't overridden
|
142
|
+
(PR: https://github.com/fnando/i18n-js/pull/551)
|
143
|
+
|
144
|
+
|
145
|
+
## [3.4.0] - 2019-10-15
|
146
|
+
|
147
|
+
### Added
|
148
|
+
|
149
|
+
- [Ruby] Allow `prefix` to be added to generated translations files
|
150
|
+
(PR: https://github.com/fnando/i18n-js/pull/549)
|
151
|
+
|
152
|
+
|
21
153
|
## [3.3.0] - 2019-06-06
|
22
154
|
|
23
155
|
### Added
|
24
156
|
|
25
|
-
- Support for `%P`, `%Z`, and `%l` strftime formats to match Ruby strftime
|
157
|
+
- [JS] Support for `%P`, `%Z`, and `%l` strftime formats to match Ruby strftime
|
158
|
+
(PR: https://github.com/fnando/i18n-js/pull/537)
|
26
159
|
|
27
160
|
|
28
161
|
## [3.2.3] - 2019-05-24
|
29
162
|
|
30
163
|
### Changed
|
31
164
|
|
32
|
-
- Allow rails 6 to be used with this gem
|
165
|
+
- [Ruby] Allow rails 6 to be used with this gem
|
33
166
|
(PR: https://github.com/fnando/i18n-js/pull/536)
|
34
167
|
|
35
168
|
|
@@ -400,7 +533,23 @@ And today is not April Fools' Day
|
|
400
533
|
|
401
534
|
|
402
535
|
|
403
|
-
[Unreleased]: https://github.com/fnando/i18n-js/compare/v3.
|
536
|
+
[Unreleased]: https://github.com/fnando/i18n-js/compare/v3.9.2...HEAD
|
537
|
+
[3.9.2]: https://github.com/fnando/i18n-js/compare/v3.9.1...v3.9.2
|
538
|
+
[3.9.1]: https://github.com/fnando/i18n-js/compare/v3.9.0...v3.9.1
|
539
|
+
[3.9.0]: https://github.com/fnando/i18n-js/compare/v3.8.4...v3.9.0
|
540
|
+
[3.8.4]: https://github.com/fnando/i18n-js/compare/v3.8.3...v3.8.4
|
541
|
+
[3.8.3]: https://github.com/fnando/i18n-js/compare/v3.8.2...v3.8.3
|
542
|
+
[3.8.2]: https://github.com/fnando/i18n-js/compare/v3.8.1...v3.8.2
|
543
|
+
[3.8.1]: https://github.com/fnando/i18n-js/compare/v3.8.0...v3.8.1
|
544
|
+
[3.8.0]: https://github.com/fnando/i18n-js/compare/v3.7.1...v3.8.0
|
545
|
+
[3.7.1]: https://github.com/fnando/i18n-js/compare/v3.7.0...v3.7.1
|
546
|
+
[3.7.0]: https://github.com/fnando/i18n-js/compare/v3.6.0...v3.7.0
|
547
|
+
[3.6.0]: https://github.com/fnando/i18n-js/compare/v3.5.1...v3.6.0
|
548
|
+
[3.5.1]: https://github.com/fnando/i18n-js/compare/v3.5.0...v3.5.1
|
549
|
+
[3.5.0]: https://github.com/fnando/i18n-js/compare/v3.4.2...v3.5.0
|
550
|
+
[3.4.2]: https://github.com/fnando/i18n-js/compare/v3.4.1...v3.4.2
|
551
|
+
[3.4.1]: https://github.com/fnando/i18n-js/compare/v3.4.0...v3.4.1
|
552
|
+
[3.4.0]: https://github.com/fnando/i18n-js/compare/v3.3.0...v3.4.0
|
404
553
|
[3.3.0]: https://github.com/fnando/i18n-js/compare/v3.2.3...v3.3.0
|
405
554
|
[3.2.3]: https://github.com/fnando/i18n-js/compare/v3.2.2...v3.2.3
|
406
555
|
[3.2.2]: https://github.com/fnando/i18n-js/compare/v3.2.1...v3.2.2
|