i18n-js 3.2.1 → 3.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/Appraisals +4 -0
- data/CHANGELOG.md +10 -1
- data/app/assets/javascripts/i18n.js +15 -5
- data/gemfiles/i18n_1_6.gemfile +7 -0
- data/lib/i18n/js/version.rb +1 -1
- data/package.json +1 -1
- data/spec/js/localization.spec.js +7 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf57fa8dfcf89f2bbe736899750fc67fbc54c461cf199f5224f13136fadaf49d
|
4
|
+
data.tar.gz: 9ac09fae9997e09d056d269b639282415b637c1a27aaba63138b3f03af12e917
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa3def42f8e86c9da13edf1faab48070cfa2b58d74f620815efb24f98af448a78f85512bf83d7c79b04d4e30c7f83d978fc1986af24fba757f5a1d79541849d9
|
7
|
+
data.tar.gz: 833f82ecfa20b6bc152dc3aa41f00dec9a6ac3820788c103ddc2cd3b37bddd76609af851e84e8a05d4e9afd83ff93fc9c8a718699c326856bac9491a5b0f9183
|
data/.travis.yml
CHANGED
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -18,6 +18,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
18
18
|
- Nothing
|
19
19
|
|
20
20
|
|
21
|
+
## [3.2.2] - 2019-05-09
|
22
|
+
|
23
|
+
### Fixed
|
24
|
+
|
25
|
+
- [JS] Return invalid date/time input values (null & undefined) as-is
|
26
|
+
(Commit: https://github.com/fnando/i18n-js/commit/869d1689ed788ff50121de492db354652971c23d)
|
27
|
+
|
28
|
+
|
21
29
|
## [3.2.1] - 2019-01-22
|
22
30
|
|
23
31
|
### Changed
|
@@ -377,7 +385,8 @@ And today is not April Fools' Day
|
|
377
385
|
|
378
386
|
|
379
387
|
|
380
|
-
[Unreleased]: https://github.com/fnando/i18n-js/compare/v3.2.
|
388
|
+
[Unreleased]: https://github.com/fnando/i18n-js/compare/v3.2.2...HEAD
|
389
|
+
[3.2.2]: https://github.com/fnando/i18n-js/compare/v3.2.1...v3.2.2
|
381
390
|
[3.2.1]: https://github.com/fnando/i18n-js/compare/v3.2.0...v3.2.1
|
382
391
|
[3.2.0]: https://github.com/fnando/i18n-js/compare/v3.1.0...v3.2.0
|
383
392
|
[3.1.0]: https://github.com/fnando/i18n-js/compare/v3.0.11...v3.1.0
|
@@ -615,7 +615,7 @@
|
|
615
615
|
|
616
616
|
// This function interpolates the all variables in the given message.
|
617
617
|
I18n.interpolate = function(message, options) {
|
618
|
-
if (message
|
618
|
+
if (message == null) {
|
619
619
|
return message;
|
620
620
|
}
|
621
621
|
|
@@ -833,8 +833,12 @@
|
|
833
833
|
//
|
834
834
|
I18n.parseDate = function(date) {
|
835
835
|
var matches, convertedDate, fraction;
|
836
|
+
// A date input of `null` or `undefined` will be returned as-is
|
837
|
+
if (date == null) {
|
838
|
+
return date;
|
839
|
+
}
|
836
840
|
// we have a date, so just return it.
|
837
|
-
if (typeof(date)
|
841
|
+
if (typeof(date) === "object") {
|
838
842
|
return date;
|
839
843
|
}
|
840
844
|
|
@@ -980,12 +984,18 @@
|
|
980
984
|
, format = this.lookup(scope)
|
981
985
|
;
|
982
986
|
|
983
|
-
|
984
|
-
|
987
|
+
// A date input of `null` or `undefined` will be returned as-is
|
988
|
+
if (date == null) {
|
989
|
+
return date;
|
990
|
+
}
|
991
|
+
|
992
|
+
var date_string = date.toString()
|
993
|
+
if (date_string.match(/invalid/i)) {
|
994
|
+
return date_string;
|
985
995
|
}
|
986
996
|
|
987
997
|
if (!format) {
|
988
|
-
return
|
998
|
+
return date_string;
|
989
999
|
}
|
990
1000
|
|
991
1001
|
return this.strftime(date, format);
|
data/lib/i18n/js/version.rb
CHANGED
data/package.json
CHANGED
@@ -34,6 +34,12 @@ describe("Localization", function(){
|
|
34
34
|
expect(I18n.l("time.formats.long", "2009-11-29 15:07:59")).toEqual("Domingo, 29 de Novembro de 2009, 15:07 h");
|
35
35
|
});
|
36
36
|
|
37
|
+
it("return 'Invalid Date' or original value for invalid input", function(){
|
38
|
+
expect(I18n.l("time.formats.default", "")).toEqual("Invalid Date");
|
39
|
+
expect(I18n.l("time.formats.default", null)).toEqual(null);
|
40
|
+
expect(I18n.l("time.formats.default", undefined)).toEqual(undefined);
|
41
|
+
});
|
42
|
+
|
37
43
|
it("localizes date/time strings with placeholders", function(){
|
38
44
|
I18n.locale = "pt-BR";
|
39
45
|
|
@@ -45,4 +51,4 @@ describe("Localization", function(){
|
|
45
51
|
I18n.locale = "pt-BR";
|
46
52
|
expect(I18n.l("percentage", 123.45)).toEqual("123,45%");
|
47
53
|
});
|
48
|
-
});
|
54
|
+
});
|
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.2.
|
4
|
+
version: 3.2.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-
|
11
|
+
date: 2019-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -124,6 +124,7 @@ files:
|
|
124
124
|
- gemfiles/i18n_1_3.gemfile
|
125
125
|
- gemfiles/i18n_1_4.gemfile
|
126
126
|
- gemfiles/i18n_1_5.gemfile
|
127
|
+
- gemfiles/i18n_1_6.gemfile
|
127
128
|
- i18n-js.gemspec
|
128
129
|
- lib/i18n-js.rb
|
129
130
|
- lib/i18n/js.rb
|
@@ -217,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
218
|
- !ruby/object:Gem::Version
|
218
219
|
version: '0'
|
219
220
|
requirements: []
|
220
|
-
rubygems_version: 3.0.
|
221
|
+
rubygems_version: 3.0.3
|
221
222
|
signing_key:
|
222
223
|
specification_version: 4
|
223
224
|
summary: It's a small library to provide the Rails I18n translations on the Javascript.
|