i18n-js 3.9.0 → 3.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.editorconfig +1 -1
- data/.github/workflows/tests.yaml +5 -0
- data/Appraisals +4 -0
- data/CHANGELOG.md +11 -2
- data/README.md +18 -16
- data/app/assets/javascripts/i18n/shims.js +3 -3
- data/app/assets/javascripts/i18n.js +7 -7
- data/gemfiles/i18n_1_9.gemfile +7 -0
- data/i18n-js.gemspec +1 -1
- data/lib/i18n/js/dependencies.rb +6 -2
- data/lib/i18n/js/engine.rb +1 -1
- data/lib/i18n/js/utils.rb +1 -1
- data/lib/i18n/js/version.rb +1 -1
- data/spec/js/require.js +4 -4
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af88256d90ed5aa70fdaf88ce224e2b3bdb378b65d3e4a826dd9073484d6d691
|
4
|
+
data.tar.gz: 3a6409f3e78871438978ebaeb10853e6c49b38eddb3be679a4bf5f550ebc1b17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93da6d4965b27b83a8064a0665b3689e8a55bf750881b4cfd00d220e3e73379c56840ff452a3fe586c66c69ff7b1f5132193160913ced2d956e2145ff4567894
|
7
|
+
data.tar.gz: 9ce7b91903ac75ee8e7c320058d45893330033eb5628b2ef1a3d8e29466053d21b931a6f1c87c15f7bb1f83bbce0c5c33a8b785c8be79c5acbdbb48eafb459ba
|
data/.editorconfig
CHANGED
@@ -4,11 +4,13 @@ on:
|
|
4
4
|
pull_request:
|
5
5
|
branches:
|
6
6
|
- main
|
7
|
+
- v3
|
7
8
|
paths-ignore:
|
8
9
|
- 'README.md'
|
9
10
|
push:
|
10
11
|
branches:
|
11
12
|
- main
|
13
|
+
- v3
|
12
14
|
paths-ignore:
|
13
15
|
- 'README.md'
|
14
16
|
|
@@ -26,6 +28,8 @@ jobs:
|
|
26
28
|
- 2.5
|
27
29
|
- 2.6
|
28
30
|
- 2.7
|
31
|
+
- '3.0'
|
32
|
+
- 3.1
|
29
33
|
gemfile:
|
30
34
|
- gemfiles/i18n_0_6.gemfile
|
31
35
|
- gemfiles/i18n_0_7.gemfile
|
@@ -40,6 +44,7 @@ jobs:
|
|
40
44
|
- gemfiles/i18n_1_6.gemfile
|
41
45
|
- gemfiles/i18n_1_7.gemfile
|
42
46
|
- gemfiles/i18n_1_8.gemfile
|
47
|
+
- gemfiles/i18n_1_9.gemfile
|
43
48
|
allow_failures:
|
44
49
|
- false
|
45
50
|
include:
|
data/Appraisals
CHANGED
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,6 +18,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
18
18
|
- Nothing
|
19
19
|
|
20
20
|
|
21
|
+
## [3.9.1] - 2022-02-08
|
22
|
+
|
23
|
+
### Changed
|
24
|
+
|
25
|
+
- [Ruby] Allow rails 7
|
26
|
+
(PR: https://github.com/fnando/i18n-js/pull/638)
|
27
|
+
|
28
|
+
|
21
29
|
## [3.9.0]
|
22
30
|
|
23
31
|
### Added
|
@@ -517,7 +525,8 @@ And today is not April Fools' Day
|
|
517
525
|
|
518
526
|
|
519
527
|
|
520
|
-
[Unreleased]: https://github.com/fnando/i18n-js/compare/v3.9.
|
528
|
+
[Unreleased]: https://github.com/fnando/i18n-js/compare/v3.9.1...HEAD
|
529
|
+
[3.9.1]: https://github.com/fnando/i18n-js/compare/v3.9.0...v3.9.1
|
521
530
|
[3.9.0]: https://github.com/fnando/i18n-js/compare/v3.8.4...v3.9.0
|
522
531
|
[3.8.4]: https://github.com/fnando/i18n-js/compare/v3.8.3...v3.8.4
|
523
532
|
[3.8.3]: https://github.com/fnando/i18n-js/compare/v3.8.2...v3.8.3
|
data/README.md
CHANGED
@@ -8,11 +8,10 @@
|
|
8
8
|
|
9
9
|
<p align="center">
|
10
10
|
<a href="https://github.com/fnando/i18n-js/actions?query=workflow%3ATests"><img src="https://github.com/fnando/i18n-js/workflows/Tests/badge.svg" alt="Tests"></a>
|
11
|
-
<a href="
|
11
|
+
<a href="https://badge.fury.io/rb/i18n-js"><img src="https://img.shields.io/gem/v/i18n-js.svg" alt="Gem Version"></a>
|
12
12
|
<a href="https://www.npmjs.com/package/i18n-js"><img src="https://img.shields.io/npm/v/i18n-js.svg" alt="npm"></a>
|
13
13
|
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
|
14
|
-
<a href="https://
|
15
|
-
<a href="https://coveralls.io/r/fnando/i18n-js"><img src="http://img.shields.io/coveralls/fnando/i18n-js.svg" alt="Coverage Status"></a>
|
14
|
+
<a href="https://coveralls.io/r/fnando/i18n-js"><img src="https://img.shields.io/coveralls/fnando/i18n-js.svg" alt="Coverage Status"></a>
|
16
15
|
<a href="https://gitter.im/fnando/i18n-js"><img src="https://img.shields.io/badge/gitter-join%20chat-1dce73.svg" alt="Gitter"></a>
|
17
16
|
</p>
|
18
17
|
|
@@ -59,10 +58,10 @@ For more details, see:
|
|
59
58
|
- [this gist](https://gist.github.com/bazzel/ecdff4718962e57c2d5569cf01d332fe)
|
60
59
|
- https://github.com/fnando/i18n-js/issues/597
|
61
60
|
|
62
|
-
#### Rails app with [Asset Pipeline](
|
61
|
+
#### Rails app with [Asset Pipeline](https://guides.rubyonrails.org/asset_pipeline.html)
|
63
62
|
|
64
63
|
If you're using the
|
65
|
-
[asset pipeline](
|
64
|
+
[asset pipeline](https://guides.rubyonrails.org/asset_pipeline.html), then you
|
66
65
|
must add the following line to your `app/assets/javascripts/application.js`.
|
67
66
|
|
68
67
|
```javascript
|
@@ -77,7 +76,7 @@ must add the following line to your `app/assets/javascripts/application.js`.
|
|
77
76
|
//= require i18n/translations
|
78
77
|
```
|
79
78
|
|
80
|
-
#### Rails app without [Asset Pipeline](
|
79
|
+
#### Rails app without [Asset Pipeline](https://guides.rubyonrails.org/asset_pipeline.html)
|
81
80
|
|
82
81
|
First, put this in your `application.html` (layout file). Then get the JS files
|
83
82
|
following the instructions below.
|
@@ -987,23 +986,26 @@ more details and discussion of this issue.
|
|
987
986
|
### JS `I18n.toCurrency` & `I18n.toNumber` cannot handle large integers
|
988
987
|
|
989
988
|
The above methods use `toFixed` and it only supports 53 bit integers. Ref:
|
990
|
-
|
989
|
+
https://2ality.com/2012/07/large-integers.html
|
991
990
|
|
992
991
|
Feel free to find & discuss possible solution(s) at issue
|
993
992
|
[#511](https://github.com/fnando/i18n-js/issues/511)
|
994
993
|
|
995
|
-
###
|
994
|
+
### May not work with all backend implementations
|
996
995
|
|
997
|
-
|
998
|
-
|
996
|
+
I18n backend implementations have to conform to a specific interface to work
|
997
|
+
with i18n-js. For backends that do not conform to the interface, you will likely
|
998
|
+
get an exception like this:
|
999
999
|
|
1000
1000
|
```
|
1001
1001
|
Undefined method 'initialized?' for <your backend class>
|
1002
1002
|
```
|
1003
1003
|
|
1004
|
-
For now, i18n-js is
|
1005
|
-
|
1006
|
-
|
1004
|
+
For now, i18n-js is compatible with the `Simple` backend and with
|
1005
|
+
`I18n::Backend::ActiveRecord` (>= 0.4.0).
|
1006
|
+
|
1007
|
+
If you need a more sophisticated backend for your rails application that doesn't
|
1008
|
+
implement the required methods, you can setup i18n-js to get translations from a
|
1007
1009
|
separate `Simple` backend, by adding the following in an initializer:
|
1008
1010
|
|
1009
1011
|
```ruby
|
@@ -1042,18 +1044,18 @@ and discussion of this issue.
|
|
1042
1044
|
|
1043
1045
|
## Maintainer
|
1044
1046
|
|
1045
|
-
- Nando Vieira - <
|
1047
|
+
- Nando Vieira - <https://nandovieira.com>
|
1046
1048
|
|
1047
1049
|
## Contributing
|
1048
1050
|
|
1049
1051
|
Once you've made your great commits:
|
1050
1052
|
|
1051
|
-
1. [Fork](
|
1053
|
+
1. [Fork](https://help.github.com/forking/) I18n.js
|
1052
1054
|
2. Create a branch with a clear name
|
1053
1055
|
3. Make your changes (Please also add/change spec, README and CHANGELOG if
|
1054
1056
|
applicable)
|
1055
1057
|
4. Push changes to the created branch
|
1056
|
-
5. [Create an Pull Request](
|
1058
|
+
5. [Create an Pull Request](https://github.com/fnando/i18n-js/pulls)
|
1057
1059
|
6. That's it!
|
1058
1060
|
|
1059
1061
|
Please respect the indentation rules and code style. And use 2 spaces, not tabs.
|
@@ -33,7 +33,7 @@ if (!Array.prototype.indexOf) {
|
|
33
33
|
}
|
34
34
|
|
35
35
|
// Production steps of ECMA-262, Edition 5, 15.4.4.18
|
36
|
-
// Reference:
|
36
|
+
// Reference: https://es5.github.com/#x15.4.4.18
|
37
37
|
// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach
|
38
38
|
if ( !Array.prototype.forEach ) {
|
39
39
|
|
@@ -53,7 +53,7 @@ if ( !Array.prototype.forEach ) {
|
|
53
53
|
var len = O.length >>> 0; // Hack to convert O.length to a UInt32
|
54
54
|
|
55
55
|
// 4. If IsCallable(callback) is false, throw a TypeError exception.
|
56
|
-
// See:
|
56
|
+
// See: https://es5.github.com/#x9.11
|
57
57
|
if ( {}.toString.call(callback) !== "[object Function]" ) {
|
58
58
|
throw new TypeError( callback + " is not a function" );
|
59
59
|
}
|
@@ -139,7 +139,7 @@ if (!Array.prototype.map) {
|
|
139
139
|
var len = O.length >>> 0;
|
140
140
|
|
141
141
|
// 4. If IsCallable(callback) is false, throw a TypeError exception.
|
142
|
-
// See:
|
142
|
+
// See: https://es5.github.com/#x9.11
|
143
143
|
if (typeof callback !== 'function') {
|
144
144
|
throw new TypeError(callback + ' is not a function');
|
145
145
|
}
|
@@ -269,23 +269,23 @@
|
|
269
269
|
}
|
270
270
|
|
271
271
|
// Locale code format 1:
|
272
|
-
// According to RFC4646 (
|
272
|
+
// According to RFC4646 (https://www.ietf.org/rfc/rfc4646.txt)
|
273
273
|
// language codes for Traditional Chinese should be `zh-Hant`
|
274
274
|
//
|
275
275
|
// But due to backward compatibility
|
276
276
|
// We use older version of IETF language tag
|
277
|
-
// @see
|
278
|
-
// @see
|
277
|
+
// @see https://www.w3.org/TR/html401/struct/dirlang.html
|
278
|
+
// @see https://en.wikipedia.org/wiki/IETF_language_tag
|
279
279
|
//
|
280
280
|
// Format: `language-code = primary-code ( "-" subcode )*`
|
281
281
|
//
|
282
282
|
// primary-code uses ISO639-1
|
283
|
-
// @see
|
284
|
-
// @see
|
283
|
+
// @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
284
|
+
// @see https://www.iso.org/iso/home/standards/language_codes.htm
|
285
285
|
//
|
286
286
|
// subcode uses ISO 3166-1 alpha-2
|
287
|
-
// @see
|
288
|
-
// @see
|
287
|
+
// @see https://en.wikipedia.org/wiki/ISO_3166
|
288
|
+
// @see https://www.iso.org/iso/country_codes.htm
|
289
289
|
//
|
290
290
|
// @note
|
291
291
|
// subcode can be in upper case or lower case
|
data/i18n-js.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Nando Vieira"]
|
10
10
|
s.email = ["fnando.vieira@gmail.com"]
|
11
|
-
s.homepage = "
|
11
|
+
s.homepage = "https://rubygems.org/gems/i18n-js"
|
12
12
|
s.summary = "It's a small library to provide the Rails I18n translations on the Javascript."
|
13
13
|
s.description = s.summary
|
14
14
|
s.license = "MIT"
|
data/lib/i18n/js/dependencies.rb
CHANGED
@@ -18,7 +18,7 @@ module I18n
|
|
18
18
|
# Call this in an initializer
|
19
19
|
def using_asset_pipeline?
|
20
20
|
assets_pipeline_available =
|
21
|
-
(rails3? || rails4? || rails5? || rails6?) &&
|
21
|
+
(rails3? || rails4? || rails5? || rails6? || rails7?) &&
|
22
22
|
Rails.respond_to?(:application) &&
|
23
23
|
Rails.application.config.respond_to?(:assets)
|
24
24
|
rails3_assets_enabled =
|
@@ -26,7 +26,7 @@ module I18n
|
|
26
26
|
assets_pipeline_available &&
|
27
27
|
Rails.application.config.assets.enabled != false
|
28
28
|
|
29
|
-
assets_pipeline_available && (rails4? || rails5? || rails6? || rails3_assets_enabled)
|
29
|
+
assets_pipeline_available && (rails4? || rails5? || rails6? || rails7? || rails3_assets_enabled)
|
30
30
|
end
|
31
31
|
|
32
32
|
private
|
@@ -46,6 +46,10 @@ module I18n
|
|
46
46
|
def rails6?
|
47
47
|
rails? && Rails.version.to_i == 6
|
48
48
|
end
|
49
|
+
|
50
|
+
def rails7?
|
51
|
+
rails? && Rails.version.to_i == 7
|
52
|
+
end
|
49
53
|
|
50
54
|
def safe_gem_check(*args)
|
51
55
|
if Gem::Specification.respond_to?(:find_by_name)
|
data/lib/i18n/js/engine.rb
CHANGED
@@ -21,7 +21,7 @@ module I18n
|
|
21
21
|
# https://github.com/rails/sprockets-rails/blob/master/lib/sprockets/railtie.rb
|
22
22
|
#
|
23
23
|
# Finisher hook is the place which should be used as border.
|
24
|
-
#
|
24
|
+
# https://guides.rubyonrails.org/configuring.html#initializers
|
25
25
|
#
|
26
26
|
# For detail see Pull Request:
|
27
27
|
# https://github.com/fnando/i18n-js/pull/371
|
data/lib/i18n/js/utils.rb
CHANGED
@@ -3,7 +3,7 @@ module I18n
|
|
3
3
|
module Utils
|
4
4
|
PLURAL_KEYS = %i[zero one two few many other].freeze
|
5
5
|
|
6
|
-
# Based on deep_merge by Stefan Rusterholz, see <
|
6
|
+
# Based on deep_merge by Stefan Rusterholz, see <https://www.ruby-forum.com/topic/142809>.
|
7
7
|
# This method is used to handle I18n fallbacks. Given two equivalent path nodes in two locale trees:
|
8
8
|
# 1. If the node in the current locale appears to be an I18n pluralization (:one, :other, etc.),
|
9
9
|
# use the node, but merge in any missing/non-nil keys from the fallback (default) locale.
|
data/lib/i18n/js/version.rb
CHANGED
data/spec/js/require.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/** vim: et:ts=4:sw=4:sts=4
|
2
2
|
* @license RequireJS 2.1.16 Copyright (c) 2010-2015, The Dojo Foundation All Rights Reserved.
|
3
3
|
* Available via the MIT or new BSD license.
|
4
|
-
* see:
|
4
|
+
* see: https://github.com/jrburke/requirejs for details
|
5
5
|
*/
|
6
6
|
//Not using strict: uneven strict support in browsers, #392, and causes
|
7
7
|
//problems with requirejs.exec()/transpiler plugins that may not be strict.
|
@@ -163,7 +163,7 @@ var requirejs, require, define;
|
|
163
163
|
* @returns {Error}
|
164
164
|
*/
|
165
165
|
function makeError(id, msg, err, requireModules) {
|
166
|
-
var e = new Error(msg + '\
|
166
|
+
var e = new Error(msg + '\nhttps://requirejs.org/docs/errors.html#' + id);
|
167
167
|
e.requireType = id;
|
168
168
|
e.requireModules = requireModules;
|
169
169
|
if (err) {
|
@@ -1810,7 +1810,7 @@ var requirejs, require, define;
|
|
1810
1810
|
head = s.head = document.getElementsByTagName('head')[0];
|
1811
1811
|
//If BASE tag is in play, using appendChild is a problem for IE6.
|
1812
1812
|
//When that browser dies, this can be removed. Details in this jQuery bug:
|
1813
|
-
//
|
1813
|
+
//https://dev.jquery.com/ticket/2709
|
1814
1814
|
baseElement = document.getElementsByTagName('base')[0];
|
1815
1815
|
if (baseElement) {
|
1816
1816
|
head = s.head = baseElement.parentNode;
|
@@ -1829,7 +1829,7 @@ var requirejs, require, define;
|
|
1829
1829
|
*/
|
1830
1830
|
req.createNode = function (config, moduleName, url) {
|
1831
1831
|
var node = config.xhtml ?
|
1832
|
-
document.createElementNS('
|
1832
|
+
document.createElementNS('https://www.w3.org/1999/xhtml', 'html:script') :
|
1833
1833
|
document.createElement('script');
|
1834
1834
|
node.type = config.scriptType || 'text/javascript';
|
1835
1835
|
node.charset = 'utf-8';
|
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.9.
|
4
|
+
version: 3.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- gemfiles/i18n_1_6.gemfile
|
129
129
|
- gemfiles/i18n_1_7.gemfile
|
130
130
|
- gemfiles/i18n_1_8.gemfile
|
131
|
+
- gemfiles/i18n_1_9.gemfile
|
131
132
|
- i18n-js.gemspec
|
132
133
|
- i18njs.png
|
133
134
|
- lib/i18n-js.rb
|
@@ -209,11 +210,11 @@ files:
|
|
209
210
|
- spec/ruby/i18n/js_spec.rb
|
210
211
|
- spec/spec_helper.rb
|
211
212
|
- yarn.lock
|
212
|
-
homepage:
|
213
|
+
homepage: https://rubygems.org/gems/i18n-js
|
213
214
|
licenses:
|
214
215
|
- MIT
|
215
216
|
metadata: {}
|
216
|
-
post_install_message:
|
217
|
+
post_install_message:
|
217
218
|
rdoc_options: []
|
218
219
|
require_paths:
|
219
220
|
- lib
|
@@ -228,8 +229,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
229
|
- !ruby/object:Gem::Version
|
229
230
|
version: '0'
|
230
231
|
requirements: []
|
231
|
-
rubygems_version: 3.
|
232
|
-
signing_key:
|
232
|
+
rubygems_version: 3.3.6
|
233
|
+
signing_key:
|
233
234
|
specification_version: 4
|
234
235
|
summary: It's a small library to provide the Rails I18n translations on the Javascript.
|
235
236
|
test_files:
|