i18n-js 3.0.9 → 3.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -1
- data/app/assets/javascripts/i18n.js +8 -4
- data/lib/i18n/js/version.rb +1 -1
- data/package.json +1 -1
- data/spec/js/extend.spec.js +4 -2
- data/spec/js/translate.spec.js +6 -0
- data/spec/js/translations.js +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d881382110db91a98e8af030855cebf2636194145c9c67203391ecc6823d34ab
|
4
|
+
data.tar.gz: 4918d0712878f819a2c90a24e624ab1fe601fffbdd6abd5c6184c53838e2bef6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6616ef9bf22c95974b742ce3f85177e50f13a4887d005865de1f8fe6f7e81f8bffc54c46df38311c6f22e8c37d0392d9ecf671185764edc6e87cc9b0f592503
|
7
|
+
data.tar.gz: cc7e6115c6fa710941512235e27fa241f9206bb366455cbc209a02ca587d3c9116ab2a67270591c408d8ac7f8136186487a200bb2d2bfa7a617a379374d96418
|
data/CHANGELOG.md
CHANGED
@@ -18,6 +18,16 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
18
18
|
- Nothing
|
19
19
|
|
20
20
|
|
21
|
+
## [3.0.10] - 2018-06-21
|
22
|
+
|
23
|
+
### Fixed
|
24
|
+
|
25
|
+
- [JS] Fix extend method changing keys with `null` to empty objects
|
26
|
+
(PR: https://github.com/fnando/i18n-js/pull/503)
|
27
|
+
- [JS] Fix variable name in an internal method
|
28
|
+
(PR: https://github.com/fnando/i18n-js/pull/501)
|
29
|
+
|
30
|
+
|
21
31
|
## [3.0.9] - 2018-06-21
|
22
32
|
|
23
33
|
### Fixed
|
@@ -316,7 +326,8 @@ And today is not April Fools' Day
|
|
316
326
|
|
317
327
|
|
318
328
|
|
319
|
-
[Unreleased]: https://github.com/fnando/i18n-js/compare/v3.0.
|
329
|
+
[Unreleased]: https://github.com/fnando/i18n-js/compare/v3.0.10...HEAD
|
330
|
+
[3.0.10]: https://github.com/fnando/i18n-js/compare/v3.0.9...v3.0.10
|
320
331
|
[3.0.9]: https://github.com/fnando/i18n-js/compare/v3.0.8...v3.0.9
|
321
332
|
[3.0.8]: https://github.com/fnando/i18n-js/compare/v3.0.7...v3.0.8
|
322
333
|
[3.0.7]: https://github.com/fnando/i18n-js/compare/v3.0.6...v3.0.7
|
@@ -70,22 +70,26 @@
|
|
70
70
|
var isArray = function(val) {
|
71
71
|
if (Array.isArray) {
|
72
72
|
return Array.isArray(val);
|
73
|
-
}
|
73
|
+
}
|
74
74
|
return Object.prototype.toString.call(val) === '[object Array]';
|
75
75
|
};
|
76
76
|
|
77
77
|
var isString = function(val) {
|
78
|
-
return typeof
|
78
|
+
return typeof val === 'string' || Object.prototype.toString.call(val) === '[object String]';
|
79
79
|
};
|
80
80
|
|
81
81
|
var isNumber = function(val) {
|
82
|
-
return typeof val
|
82
|
+
return typeof val === 'number' || Object.prototype.toString.call(val) === '[object Number]';
|
83
83
|
};
|
84
84
|
|
85
85
|
var isBoolean = function(val) {
|
86
86
|
return val === true || val === false;
|
87
87
|
};
|
88
88
|
|
89
|
+
var isNull = function(val) {
|
90
|
+
return val === null;
|
91
|
+
};
|
92
|
+
|
89
93
|
var decimalAdjust = function(type, value, exp) {
|
90
94
|
// If the exp is undefined or zero...
|
91
95
|
if (typeof exp === 'undefined' || +exp === 0) {
|
@@ -117,7 +121,7 @@
|
|
117
121
|
var key, value;
|
118
122
|
for (key in obj) if (obj.hasOwnProperty(key)) {
|
119
123
|
value = obj[key];
|
120
|
-
if (isString(value) || isNumber(value) || isBoolean(value) || isArray(value)) {
|
124
|
+
if (isString(value) || isNumber(value) || isBoolean(value) || isArray(value) || isNull(value)) {
|
121
125
|
dest[key] = value;
|
122
126
|
} else {
|
123
127
|
if (dest[key] == null) dest[key] = {};
|
data/lib/i18n/js/version.rb
CHANGED
data/package.json
CHANGED
data/spec/js/extend.spec.js
CHANGED
@@ -60,7 +60,7 @@ describe("Extend", function () {
|
|
60
60
|
expect(I18n.extend(obj1, obj2)).toEqual(expected);
|
61
61
|
});
|
62
62
|
|
63
|
-
it("should correctly merge string, numberic and
|
63
|
+
it("should correctly merge string, numberic, boolean, and null values", function() {
|
64
64
|
var obj1 = {
|
65
65
|
test1: {
|
66
66
|
test2: false
|
@@ -69,7 +69,8 @@ describe("Extend", function () {
|
|
69
69
|
, obj2 = {
|
70
70
|
test1: {
|
71
71
|
test3: 23,
|
72
|
-
test4: 'abc'
|
72
|
+
test4: 'abc',
|
73
|
+
test5: null
|
73
74
|
}
|
74
75
|
}
|
75
76
|
, expected = {
|
@@ -77,6 +78,7 @@ describe("Extend", function () {
|
|
77
78
|
test2: false
|
78
79
|
, test3: 23
|
79
80
|
, test4: 'abc'
|
81
|
+
, test5: null
|
80
82
|
}
|
81
83
|
}
|
82
84
|
|
data/spec/js/translate.spec.js
CHANGED
@@ -18,6 +18,12 @@ describe("Translate", function(){
|
|
18
18
|
expect(I18n.t("greetings")).toEqual(I18n.translations.en.greetings);
|
19
19
|
});
|
20
20
|
|
21
|
+
it("returns missing message translation for valid scope with null", function(){
|
22
|
+
actual = I18n.t("null_key");
|
23
|
+
expected = '[missing "en.null_key" translation]';
|
24
|
+
expect(actual).toEqual(expected);
|
25
|
+
});
|
26
|
+
|
21
27
|
it("returns missing message translation for invalid scope", function(){
|
22
28
|
actual = I18n.t("invalid.scope");
|
23
29
|
expected = '[missing "en.invalid.scope" translation]';
|
data/spec/js/translations.js
CHANGED
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.0.
|
4
|
+
version: 3.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|