i18n-js 3.1.0 → 3.2.0
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/.gitignore +1 -0
- data/.travis.yml +6 -9
- data/Appraisals +4 -8
- data/CHANGELOG.md +22 -9
- data/README.md +41 -2
- data/gemfiles/{i18n_0_7.gemfile → i18n_1_1.gemfile} +1 -1
- data/i18n-js.gemspec +4 -1
- data/lib/i18n/js.rb +8 -0
- data/lib/i18n/js/errors.rb +9 -0
- data/lib/i18n/js/segment.rb +14 -3
- data/lib/i18n/js/version.rb +1 -1
- data/spec/fixtures/json_only.yml +8 -0
- data/spec/ruby/i18n/js/segment_spec.rb +32 -0
- data/spec/ruby/i18n/js_spec.rb +18 -2
- data/spec/spec_helper.rb +19 -0
- metadata +23 -7
- data/gemfiles/i18n_0_6.gemfile +0 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d31e5a96a37e60b0fddf00af9f9bad30a93b66adde3d85e3ad9b9b2771c31bdc
|
|
4
|
+
data.tar.gz: e615279399a220d76c6678d63e797b2abd5b843ae92078fab95b1bfc220b2b16
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f43b695fba0788ca02c5a36776b1f197895cc639640f4fc96a1bb5a8cd236229991f69ab83c08e1a2d0163cc77f68832ba45b34c0f61903b28b76305e590ff94
|
|
7
|
+
data.tar.gz: 387b2be62ae991d415c9c599cf9b56c4162654bbb2ee5cd5e11b8b264f6d79f2f14b007d16051c4a9d1c5a0b50d15f8f94cbe2b9dea2623a9daf1fe6b92c67bf
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
|
@@ -8,13 +8,11 @@ cache:
|
|
|
8
8
|
directories:
|
|
9
9
|
- node_modules
|
|
10
10
|
rvm:
|
|
11
|
-
- 2.1
|
|
12
|
-
- 2.2
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- 2.
|
|
16
|
-
- 2.4.3
|
|
17
|
-
- 2.5.0
|
|
11
|
+
- 2.1
|
|
12
|
+
- 2.2
|
|
13
|
+
- 2.3
|
|
14
|
+
- 2.4
|
|
15
|
+
- 2.5
|
|
18
16
|
- ruby-head
|
|
19
17
|
before_install:
|
|
20
18
|
# Need to install something extra to test JS
|
|
@@ -23,11 +21,10 @@ before_install:
|
|
|
23
21
|
# https://github.com/travis-ci/travis-ci/issues/8978#issuecomment-354036443
|
|
24
22
|
- gem update --system
|
|
25
23
|
gemfile:
|
|
26
|
-
- gemfiles/i18n_0_6.gemfile
|
|
27
|
-
- gemfiles/i18n_0_7.gemfile
|
|
28
24
|
- gemfiles/i18n_0_8.gemfile
|
|
29
25
|
- gemfiles/i18n_0_9.gemfile
|
|
30
26
|
- gemfiles/i18n_1_0.gemfile
|
|
27
|
+
- gemfiles/i18n_1_1.gemfile
|
|
31
28
|
matrix:
|
|
32
29
|
fast_finish: true
|
|
33
30
|
allow_failures:
|
data/Appraisals
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
appraise "i18n_0_6" do
|
|
3
|
-
gem "i18n", "~> 0.6.0", ">= 0.6.6"
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
appraise "i18n_0_7" do
|
|
7
|
-
gem "i18n", "~> 0.7.0"
|
|
8
|
-
end
|
|
9
|
-
|
|
10
2
|
appraise "i18n_0_8" do
|
|
11
3
|
gem "i18n", "~> 0.8.0"
|
|
12
4
|
end
|
|
@@ -18,3 +10,7 @@ end
|
|
|
18
10
|
appraise "i18n_1_0" do
|
|
19
11
|
gem "i18n", "~> 1.0.0"
|
|
20
12
|
end
|
|
13
|
+
|
|
14
|
+
appraise "i18n_1_1" do
|
|
15
|
+
gem "i18n", "~> 1.1.0"
|
|
16
|
+
end
|
data/CHANGELOG.md
CHANGED
|
@@ -18,16 +18,28 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
18
18
|
- Nothing
|
|
19
19
|
|
|
20
20
|
|
|
21
|
+
## [3.2.0] - 2018-11-16
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- [Ruby] Add option `json_only` to generate translations in JSON
|
|
26
|
+
(PR: https://github.com/fnando/i18n-js/pull/524)
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- [Ruby] Requires `i18n` to be `>= 0.8.0` for CVE-2014-10077
|
|
31
|
+
|
|
32
|
+
|
|
21
33
|
## [3.1.0] - 2018-11-01
|
|
22
34
|
|
|
23
35
|
### Added
|
|
24
36
|
|
|
25
|
-
- [Ruby] Add option to allow setting a different I18n backend
|
|
37
|
+
- [Ruby] Add option to allow setting a different I18n backend
|
|
26
38
|
(PR: https://github.com/fnando/i18n-js/pull/519)
|
|
27
39
|
|
|
28
40
|
### Fixed
|
|
29
41
|
|
|
30
|
-
- [JS] Fix missing translation when pluralizing with default scopes
|
|
42
|
+
- [JS] Fix missing translation when pluralizing with default scopes
|
|
31
43
|
(PR: https://github.com/fnando/i18n-js/pull/516)
|
|
32
44
|
|
|
33
45
|
|
|
@@ -35,7 +47,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
35
47
|
|
|
36
48
|
### Fixed
|
|
37
49
|
|
|
38
|
-
- [JS] Fix interpolation for array with non string/null elements
|
|
50
|
+
- [JS] Fix interpolation for array with non string/null elements
|
|
39
51
|
(PR: https://github.com/fnando/i18n-js/pull/505)
|
|
40
52
|
|
|
41
53
|
|
|
@@ -43,9 +55,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
43
55
|
|
|
44
56
|
### Fixed
|
|
45
57
|
|
|
46
|
-
- [JS] Fix extend method changing keys with `null` to empty objects
|
|
58
|
+
- [JS] Fix extend method changing keys with `null` to empty objects
|
|
47
59
|
(PR: https://github.com/fnando/i18n-js/pull/503)
|
|
48
|
-
- [JS] Fix variable name in an internal method
|
|
60
|
+
- [JS] Fix variable name in an internal method
|
|
49
61
|
(PR: https://github.com/fnando/i18n-js/pull/501)
|
|
50
62
|
|
|
51
63
|
|
|
@@ -60,7 +72,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
60
72
|
|
|
61
73
|
### Changed
|
|
62
74
|
|
|
63
|
-
- [JS] Interpolate translation array too
|
|
75
|
+
- [JS] Interpolate translation array too
|
|
64
76
|
(PR: https://github.com/fnando/i18n-js/pull/498)
|
|
65
77
|
|
|
66
78
|
|
|
@@ -75,7 +87,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
75
87
|
|
|
76
88
|
### Fixed
|
|
77
89
|
|
|
78
|
-
- [Ruby] Make JS `i18n/filtered` depends on i18n-js config too
|
|
90
|
+
- [Ruby] Make JS `i18n/filtered` depends on i18n-js config too
|
|
79
91
|
(PR: https://github.com/fnando/i18n-js/pull/497)
|
|
80
92
|
|
|
81
93
|
|
|
@@ -347,8 +359,9 @@ And today is not April Fools' Day
|
|
|
347
359
|
|
|
348
360
|
|
|
349
361
|
|
|
350
|
-
[Unreleased]: https://github.com/fnando/i18n-js/compare/v3.
|
|
351
|
-
[3.
|
|
362
|
+
[Unreleased]: https://github.com/fnando/i18n-js/compare/v3.2.0...HEAD
|
|
363
|
+
[3.2.0]: https://github.com/fnando/i18n-js/compare/v3.1.0...v3.2.0
|
|
364
|
+
[3.1.0]: https://github.com/fnando/i18n-js/compare/v3.0.11...v3.1.0
|
|
352
365
|
[3.0.11]: https://github.com/fnando/i18n-js/compare/v3.0.10...v3.0.11
|
|
353
366
|
[3.0.10]: https://github.com/fnando/i18n-js/compare/v3.0.9...v3.0.10
|
|
354
367
|
[3.0.9]: https://github.com/fnando/i18n-js/compare/v3.0.8...v3.0.9
|
data/README.md
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
6
|
[](https://travis-ci.org/fnando/i18n-js)
|
|
7
|
-
[](https://codeclimate.com/github/fnando/i18n-js)
|
|
7
|
+
[](https://coveralls.io/r/fnando/i18n-js)
|
|
9
8
|
|
|
10
9
|
[](https://gitter.im/fnando/i18n-js)
|
|
11
10
|
|
|
@@ -827,6 +826,46 @@ Ref: http://2ality.com/2012/07/large-integers.html
|
|
|
827
826
|
|
|
828
827
|
Feel free to find & discuss possible solution(s) at issue [#511](https://github.com/fnando/i18n-js/issues/511)
|
|
829
828
|
|
|
829
|
+
### Only works with `Simple` backend
|
|
830
|
+
|
|
831
|
+
If you set `I18n.backend` to something other than the default `Simple` backend, you will likely get an exception like this:
|
|
832
|
+
|
|
833
|
+
```
|
|
834
|
+
Undefined method 'initialized?' for <your backend class>
|
|
835
|
+
```
|
|
836
|
+
|
|
837
|
+
For now, i18n-js is only compatible with the `Simple` backend.
|
|
838
|
+
If you need a more sophisticated backend for your rails application, like `I18n::Backend::ActiveRecord`, you can setup i18n-js to get translations from a separate `Simple` backend, by adding the following in an initializer:
|
|
839
|
+
|
|
840
|
+
```ruby
|
|
841
|
+
I18n::JS.backend = I18n.backend
|
|
842
|
+
I18n.backend = I18n::Backend::Chain.new(<your other backend(s)>, I18n.backend)
|
|
843
|
+
```
|
|
844
|
+
|
|
845
|
+
This will use your backend with the default `Simple` backend as fallback, while i18n-js only sees and uses the simple backend.
|
|
846
|
+
This means however, that only translations from your static locale files will be present in JavaScript.
|
|
847
|
+
|
|
848
|
+
If you do cannot use a `Chain`-Backend for some reason, you can also set
|
|
849
|
+
|
|
850
|
+
```ruby
|
|
851
|
+
I18n::JS.backend = I18n::Backend::Simple.new
|
|
852
|
+
I18n.backend = <something different>
|
|
853
|
+
```
|
|
854
|
+
|
|
855
|
+
However, the automatic reloading of translations in developement will not work in this case.
|
|
856
|
+
This is because Rails calls `I18n.reload!` for each request in development, but `reload!` will not be called on `I18n::JS.backend`, since it is a different object.
|
|
857
|
+
One option would be to patch `I18n.reload!` in an initializer:
|
|
858
|
+
|
|
859
|
+
```ruby
|
|
860
|
+
module I18n
|
|
861
|
+
def self.reload!
|
|
862
|
+
I18n::JS.backend.reload!
|
|
863
|
+
super
|
|
864
|
+
end
|
|
865
|
+
end
|
|
866
|
+
```
|
|
867
|
+
|
|
868
|
+
See issue [#428](https://github.com/fnando/i18n-js/issues/428) for more details and discussion of this issue.
|
|
830
869
|
|
|
831
870
|
## Maintainer
|
|
832
871
|
|
data/i18n-js.gemspec
CHANGED
|
@@ -18,12 +18,15 @@ Gem::Specification.new do |s|
|
|
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
19
19
|
s.require_paths = ["lib"]
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
# CVE-2014-10077 which is fixed for >= 0.8.0
|
|
22
|
+
# https://nvd.nist.gov/vuln/detail/CVE-2014-10077
|
|
23
|
+
s.add_dependency "i18n", ">= 0.8.0", "< 2"
|
|
22
24
|
|
|
23
25
|
s.add_development_dependency "appraisal", "~> 2.0"
|
|
24
26
|
s.add_development_dependency "rspec", "~> 3.0"
|
|
25
27
|
s.add_development_dependency "rake", "~> 12.0"
|
|
26
28
|
s.add_development_dependency "gem-release", ">= 0.7"
|
|
29
|
+
s.add_development_dependency "coveralls", ">= 0.7"
|
|
27
30
|
|
|
28
31
|
s.required_ruby_version = ">= 2.1.0"
|
|
29
32
|
end
|
data/lib/i18n/js.rb
CHANGED
|
@@ -187,6 +187,13 @@ module I18n
|
|
|
187
187
|
fallbacks != false
|
|
188
188
|
end
|
|
189
189
|
|
|
190
|
+
def self.json_only
|
|
191
|
+
config.fetch(:json_only) do
|
|
192
|
+
# default value
|
|
193
|
+
false
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
190
197
|
def self.fallbacks
|
|
191
198
|
config.fetch(:fallbacks) do
|
|
192
199
|
# default value
|
|
@@ -215,6 +222,7 @@ module I18n
|
|
|
215
222
|
segment_options = Private::HashWithSymbolKeys.new({
|
|
216
223
|
js_extend: js_extend,
|
|
217
224
|
sort_translation_keys: sort_translation_keys?,
|
|
225
|
+
json_only: json_only
|
|
218
226
|
}).freeze
|
|
219
227
|
segment_options.merge(options.slice(*Segment::OPTIONS))
|
|
220
228
|
end
|
data/lib/i18n/js/segment.rb
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
require "i18n/js/private/hash_with_symbol_keys"
|
|
2
|
+
require "i18n/js/errors"
|
|
2
3
|
|
|
3
4
|
module I18n
|
|
4
5
|
module JS
|
|
5
6
|
|
|
6
7
|
# Class which enscapulates a translations hash and outputs a single JSON translation file
|
|
7
8
|
class Segment
|
|
8
|
-
OPTIONS = [:namespace, :pretty_print, :js_extend, :sort_translation_keys].freeze
|
|
9
|
+
OPTIONS = [:namespace, :pretty_print, :js_extend, :sort_translation_keys, :json_only].freeze
|
|
9
10
|
LOCALE_INTERPOLATOR = /%\{locale\}/
|
|
10
11
|
|
|
11
12
|
attr_reader *([:file, :translations] | OPTIONS)
|
|
@@ -23,6 +24,7 @@ module I18n
|
|
|
23
24
|
@pretty_print = !!options[:pretty_print]
|
|
24
25
|
@js_extend = options.key?(:js_extend) ? !!options[:js_extend] : true
|
|
25
26
|
@sort_translation_keys = options.key?(:sort_translation_keys) ? !!options[:sort_translation_keys] : true
|
|
27
|
+
@json_only = options.key?(:json_only) ? !!options[:json_only] : false
|
|
26
28
|
end
|
|
27
29
|
|
|
28
30
|
# Saves JSON file containing translations
|
|
@@ -32,6 +34,9 @@ module I18n
|
|
|
32
34
|
write_file(file_for_locale(locale), @translations.slice(locale))
|
|
33
35
|
end
|
|
34
36
|
else
|
|
37
|
+
if @json_only
|
|
38
|
+
raise I18n::JS::JsonOnlyLocaleRequiredError
|
|
39
|
+
end
|
|
35
40
|
write_file
|
|
36
41
|
end
|
|
37
42
|
end
|
|
@@ -53,7 +58,11 @@ module I18n
|
|
|
53
58
|
end
|
|
54
59
|
|
|
55
60
|
def js_header
|
|
56
|
-
|
|
61
|
+
if @json_only
|
|
62
|
+
''
|
|
63
|
+
else
|
|
64
|
+
%(#{@namespace}.translations || (#{@namespace}.translations = {});\n)
|
|
65
|
+
end
|
|
57
66
|
end
|
|
58
67
|
|
|
59
68
|
def js_translations(locale, translations)
|
|
@@ -63,7 +72,9 @@ module I18n
|
|
|
63
72
|
end
|
|
64
73
|
|
|
65
74
|
def js_translations_line(locale, translations)
|
|
66
|
-
if @
|
|
75
|
+
if @json_only
|
|
76
|
+
%({"#{locale}":#{translations}})
|
|
77
|
+
elsif @js_extend
|
|
67
78
|
%(#{@namespace}.translations["#{locale}"] = I18n.extend((#{@namespace}.translations["#{locale}"] || {}), #{translations});\n)
|
|
68
79
|
else
|
|
69
80
|
%(#{@namespace}.translations["#{locale}"] = #{translations};\n)
|
data/lib/i18n/js/version.rb
CHANGED
|
@@ -6,10 +6,12 @@ describe I18n::JS::Segment do
|
|
|
6
6
|
let(:translations){ { en: { "test" => "Test" }, fr: { "test" => "Test2" } } }
|
|
7
7
|
let(:namespace) { "MyNamespace" }
|
|
8
8
|
let(:pretty_print){ nil }
|
|
9
|
+
let(:json_only) { nil }
|
|
9
10
|
let(:js_extend) { nil }
|
|
10
11
|
let(:sort_translation_keys){ nil }
|
|
11
12
|
let(:options) { { namespace: namespace,
|
|
12
13
|
pretty_print: pretty_print,
|
|
14
|
+
json_only: json_only,
|
|
13
15
|
js_extend: js_extend,
|
|
14
16
|
sort_translation_keys: sort_translation_keys }.delete_if{|k,v| v.nil?} }
|
|
15
17
|
subject { I18n::JS::Segment.new(file, translations, options) }
|
|
@@ -59,6 +61,36 @@ describe I18n::JS::Segment do
|
|
|
59
61
|
end
|
|
60
62
|
end
|
|
61
63
|
|
|
64
|
+
describe "#saving!" do
|
|
65
|
+
before { allow(I18n::JS).to receive(:export_i18n_js_dir_path).and_return(temp_path) }
|
|
66
|
+
|
|
67
|
+
context "when json_only is true" do
|
|
68
|
+
let(:file){ "tmp/i18n-js/%{locale}.js" }
|
|
69
|
+
let(:json_only){ true }
|
|
70
|
+
it 'should output the keys as sorted' do
|
|
71
|
+
subject.save!
|
|
72
|
+
file_should_exist "en.js"
|
|
73
|
+
file_should_exist "fr.js"
|
|
74
|
+
|
|
75
|
+
File.open(File.join(temp_path, "en.js")){|f| f.read}.should eql(
|
|
76
|
+
%Q({"en":{"test":"Test"}})
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
File.open(File.join(temp_path, "fr.js")){|f| f.read}.should eql(
|
|
80
|
+
%Q({"fr":{"test":"Test2"}})
|
|
81
|
+
)
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
context "when json_only is true without locale" do
|
|
86
|
+
let(:file){ "tmp/i18n-js/segment.js" }
|
|
87
|
+
let(:json_only){ true }
|
|
88
|
+
it 'should output the keys as sorted' do
|
|
89
|
+
expect { subject.save! }.to raise_error(I18n::JS::JsonOnlyLocaleRequiredError)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
62
94
|
describe "#save!" do
|
|
63
95
|
before { allow(I18n::JS).to receive(:export_i18n_js_dir_path).and_return(temp_path) }
|
|
64
96
|
before { subject.save! }
|
data/spec/ruby/i18n/js_spec.rb
CHANGED
|
@@ -30,14 +30,14 @@ describe I18n::JS do
|
|
|
30
30
|
|
|
31
31
|
it "exports messages using custom output path" do
|
|
32
32
|
set_config "custom_path.yml"
|
|
33
|
-
I18n::JS::Segment.should_receive(:new).with("tmp/i18n-js/all.js", translations, {js_extend: true, sort_translation_keys: true}).and_call_original
|
|
33
|
+
I18n::JS::Segment.should_receive(:new).with("tmp/i18n-js/all.js", translations, {js_extend: true, sort_translation_keys: true, json_only: false}).and_call_original
|
|
34
34
|
I18n::JS::Segment.any_instance.should_receive(:save!).with(no_args)
|
|
35
35
|
I18n::JS.export
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
it "sets default scope to * when not specified" do
|
|
39
39
|
set_config "no_scope.yml"
|
|
40
|
-
I18n::JS::Segment.should_receive(:new).with("tmp/i18n-js/no_scope.js", translations, {js_extend: true, sort_translation_keys: true}).and_call_original
|
|
40
|
+
I18n::JS::Segment.should_receive(:new).with("tmp/i18n-js/no_scope.js", translations, {js_extend: true, sort_translation_keys: true, json_only: false}).and_call_original
|
|
41
41
|
I18n::JS::Segment.any_instance.should_receive(:save!).with(no_args)
|
|
42
42
|
I18n::JS.export
|
|
43
43
|
end
|
|
@@ -109,6 +109,22 @@ EOS
|
|
|
109
109
|
)
|
|
110
110
|
end
|
|
111
111
|
|
|
112
|
+
it "exports as json only" do
|
|
113
|
+
set_config "json_only.yml"
|
|
114
|
+
I18n::JS.export
|
|
115
|
+
en_output = File.read(File.join(I18n::JS.export_i18n_js_dir_path, "json_only.en.js"))
|
|
116
|
+
fr_output = File.read(File.join(I18n::JS.export_i18n_js_dir_path, "json_only.fr.js"))
|
|
117
|
+
expect(en_output).to eq (<<EOS
|
|
118
|
+
{"en":{"date":{"formats":{"default":"%Y-%m-%d","long":"%B %d, %Y","short":"%b %d"}},"number":{"currency":{"format":{"delimiter":",","format":"%u%n","precision":2,"separator":".","unit":"$"}}}}}
|
|
119
|
+
EOS
|
|
120
|
+
).chop
|
|
121
|
+
expect(fr_output).to eq (<<EOS
|
|
122
|
+
{"fr":{"date":{"formats":{"default":"%d/%m/%Y","long":"%e %B %Y","long_ordinal":"%e %B %Y","only_day":"%e","short":"%e %b"}},"number":{"currency":{"format":{"format":"%n %u","precision":2,"unit":"€"}}}}}
|
|
123
|
+
EOS
|
|
124
|
+
).chop
|
|
125
|
+
expect(JSON.parse(en_output).keys.first).to eq 'en'
|
|
126
|
+
end
|
|
127
|
+
|
|
112
128
|
it "exports with :except condition" do
|
|
113
129
|
set_config "except_condition.yml"
|
|
114
130
|
I18n::JS.export
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,8 +1,27 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'bundler'
|
|
3
|
+
|
|
4
|
+
begin
|
|
5
|
+
require 'simplecov'
|
|
6
|
+
SimpleCov.start do
|
|
7
|
+
add_filter 'spec'
|
|
8
|
+
end
|
|
9
|
+
rescue LoadError
|
|
10
|
+
# SimpleCov ain't available - continue
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
if ENV["TRAVIS"]
|
|
14
|
+
require "coveralls"
|
|
15
|
+
Coveralls.wear!("rails")
|
|
16
|
+
end
|
|
17
|
+
|
|
1
18
|
require "i18n"
|
|
2
19
|
require "json"
|
|
3
20
|
|
|
4
21
|
require "i18n/js"
|
|
5
22
|
|
|
23
|
+
require "rspec"
|
|
24
|
+
|
|
6
25
|
module Helpers
|
|
7
26
|
# Set the configuration as the current one
|
|
8
27
|
def set_config(path)
|
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.
|
|
4
|
+
version: 3.2.0
|
|
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-11-
|
|
11
|
+
date: 2018-11-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: i18n
|
|
@@ -16,7 +16,7 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.
|
|
19
|
+
version: 0.8.0
|
|
20
20
|
- - "<"
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
22
|
version: '2'
|
|
@@ -26,7 +26,7 @@ dependencies:
|
|
|
26
26
|
requirements:
|
|
27
27
|
- - ">="
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: 0.
|
|
29
|
+
version: 0.8.0
|
|
30
30
|
- - "<"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
32
|
version: '2'
|
|
@@ -86,6 +86,20 @@ dependencies:
|
|
|
86
86
|
- - ">="
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
88
|
version: '0.7'
|
|
89
|
+
- !ruby/object:Gem::Dependency
|
|
90
|
+
name: coveralls
|
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - ">="
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '0.7'
|
|
96
|
+
type: :development
|
|
97
|
+
prerelease: false
|
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '0.7'
|
|
89
103
|
description: It's a small library to provide the Rails I18n translations on the Javascript.
|
|
90
104
|
email:
|
|
91
105
|
- fnando.vieira@gmail.com
|
|
@@ -106,16 +120,16 @@ files:
|
|
|
106
120
|
- app/assets/javascripts/i18n/filtered.js.erb
|
|
107
121
|
- app/assets/javascripts/i18n/shims.js
|
|
108
122
|
- app/assets/javascripts/i18n/translations.js
|
|
109
|
-
- gemfiles/i18n_0_6.gemfile
|
|
110
|
-
- gemfiles/i18n_0_7.gemfile
|
|
111
123
|
- gemfiles/i18n_0_8.gemfile
|
|
112
124
|
- gemfiles/i18n_0_9.gemfile
|
|
113
125
|
- gemfiles/i18n_1_0.gemfile
|
|
126
|
+
- gemfiles/i18n_1_1.gemfile
|
|
114
127
|
- i18n-js.gemspec
|
|
115
128
|
- lib/i18n-js.rb
|
|
116
129
|
- lib/i18n/js.rb
|
|
117
130
|
- lib/i18n/js/dependencies.rb
|
|
118
131
|
- lib/i18n/js/engine.rb
|
|
132
|
+
- lib/i18n/js/errors.rb
|
|
119
133
|
- lib/i18n/js/fallback_locales.rb
|
|
120
134
|
- lib/i18n/js/middleware.rb
|
|
121
135
|
- lib/i18n/js/private/hash_with_symbol_keys.rb
|
|
@@ -144,6 +158,7 @@ files:
|
|
|
144
158
|
- spec/fixtures/js_file_with_namespace_and_pretty_print.yml
|
|
145
159
|
- spec/fixtures/js_sort_translation_keys_false.yml
|
|
146
160
|
- spec/fixtures/js_sort_translation_keys_true.yml
|
|
161
|
+
- spec/fixtures/json_only.yml
|
|
147
162
|
- spec/fixtures/locales.yml
|
|
148
163
|
- spec/fixtures/multiple_conditions.yml
|
|
149
164
|
- spec/fixtures/multiple_conditions_per_locale.yml
|
|
@@ -200,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
200
215
|
version: '0'
|
|
201
216
|
requirements: []
|
|
202
217
|
rubyforge_project:
|
|
203
|
-
rubygems_version: 2.7.
|
|
218
|
+
rubygems_version: 2.7.8
|
|
204
219
|
signing_key:
|
|
205
220
|
specification_version: 4
|
|
206
221
|
summary: It's a small library to provide the Rails I18n translations on the Javascript.
|
|
@@ -223,6 +238,7 @@ test_files:
|
|
|
223
238
|
- spec/fixtures/js_file_with_namespace_and_pretty_print.yml
|
|
224
239
|
- spec/fixtures/js_sort_translation_keys_false.yml
|
|
225
240
|
- spec/fixtures/js_sort_translation_keys_true.yml
|
|
241
|
+
- spec/fixtures/json_only.yml
|
|
226
242
|
- spec/fixtures/locales.yml
|
|
227
243
|
- spec/fixtures/multiple_conditions.yml
|
|
228
244
|
- spec/fixtures/multiple_conditions_per_locale.yml
|