i18n-js 3.5.1 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/Appraisals +4 -0
- data/CHANGELOG.md +10 -1
- data/README.md +7 -2
- data/gemfiles/i18n_1_8.gemfile +7 -0
- data/lib/i18n/js/formatters/base.rb +2 -1
- data/lib/i18n/js/formatters/js.rb +1 -1
- data/lib/i18n/js/segment.rb +5 -2
- data/lib/i18n/js/version.rb +1 -1
- data/spec/fixtures/js_file_with_namespace_prefix_and_pretty_print.yml +1 -0
- data/spec/ruby/i18n/js_spec.rb +2 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29ffee5ef86025eb985994d60c97d8cd88d915993faa3c5016ee441151dd5d2c
|
4
|
+
data.tar.gz: 208ed897a249121db4fabb69344f362afbe716888f5f8e7a7fae0857fc5f3764
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f3c3cf2649ae0d92fb9eb641c500a198f4228842f96e39948a9aaddcef01f8a5c2cd1967f83b6f2a7d70766d59f95c82da91a20bcecccc2ccd8c0a5ff1f19db
|
7
|
+
data.tar.gz: fa583dcd0070426fec841dc5a699837703ec3fa511fa1155e5d154909e733aba915cc6caf7543166652eab26ac64dfe7a9329d42e46238f784bc9ed18f144660
|
data/.travis.yml
CHANGED
@@ -12,6 +12,7 @@ rvm:
|
|
12
12
|
- 2.4
|
13
13
|
- 2.5
|
14
14
|
- 2.6
|
15
|
+
- 2.7
|
15
16
|
- ruby-head
|
16
17
|
before_install:
|
17
18
|
# Needed to test JS
|
@@ -29,6 +30,7 @@ gemfile:
|
|
29
30
|
- gemfiles/i18n_1_5.gemfile
|
30
31
|
- gemfiles/i18n_1_6.gemfile
|
31
32
|
- gemfiles/i18n_1_7.gemfile
|
33
|
+
- gemfiles/i18n_1_8.gemfile
|
32
34
|
matrix:
|
33
35
|
fast_finish: true
|
34
36
|
allow_failures:
|
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.6.0] - 2020-02-14
|
22
|
+
|
23
|
+
### Added
|
24
|
+
|
25
|
+
- [Ruby] Allow `suffix` to be added to generated translations files
|
26
|
+
(PR: https://github.com/fnando/i18n-js/pull/561)
|
27
|
+
|
28
|
+
|
21
29
|
## [3.5.1] - 2019-12-21
|
22
30
|
|
23
31
|
### Changed
|
@@ -441,7 +449,8 @@ And today is not April Fools' Day
|
|
441
449
|
|
442
450
|
|
443
451
|
|
444
|
-
[Unreleased]: https://github.com/fnando/i18n-js/compare/v3.
|
452
|
+
[Unreleased]: https://github.com/fnando/i18n-js/compare/v3.6.0...HEAD
|
453
|
+
[3.6.0]: https://github.com/fnando/i18n-js/compare/v3.5.1...v3.6.0
|
445
454
|
[3.5.1]: https://github.com/fnando/i18n-js/compare/v3.5.0...v3.5.1
|
446
455
|
[3.5.0]: https://github.com/fnando/i18n-js/compare/v3.4.2...v3.5.0
|
447
456
|
[3.4.2]: https://github.com/fnando/i18n-js/compare/v3.4.1...v3.4.2
|
data/README.md
CHANGED
@@ -248,9 +248,9 @@ MyNamespace.translations["en"] = { ... }
|
|
248
248
|
```
|
249
249
|
|
250
250
|
|
251
|
-
### Adding
|
251
|
+
### Adding prefix & suffix to the translations file(s)
|
252
252
|
|
253
|
-
Setting the `prefix: "import I18n from 'i18n-js';\n"` option will add the line at the
|
253
|
+
Setting the `prefix: "import I18n from 'i18n-js';\n"` option will add the line at the beginning of the resultant translation file.
|
254
254
|
This can be useful to use this gem with the [i18n-js](https://www.npmjs.com/package/i18n-js) npm package, which is quite useful to use it with webpack.
|
255
255
|
The user should provide the semi-colon and the newline character if needed.
|
256
256
|
|
@@ -267,6 +267,11 @@ will create:
|
|
267
267
|
```
|
268
268
|
import I18n from 'i18n-js';
|
269
269
|
I18n.translations || (I18n.translations = {});
|
270
|
+
```
|
271
|
+
|
272
|
+
|
273
|
+
`suffix` option is added in https://github.com/fnando/i18n-js/pull/561.
|
274
|
+
It's similar to `prefix` so won't explain it in details.
|
270
275
|
|
271
276
|
|
272
277
|
#### Pretty Print
|
@@ -2,11 +2,12 @@ module I18n
|
|
2
2
|
module JS
|
3
3
|
module Formatters
|
4
4
|
class Base
|
5
|
-
def initialize(js_extend: false, namespace: nil, pretty_print: false, prefix: nil)
|
5
|
+
def initialize(js_extend: false, namespace: nil, pretty_print: false, prefix: nil, suffix: nil)
|
6
6
|
@js_extend = js_extend
|
7
7
|
@namespace = namespace
|
8
8
|
@pretty_print = pretty_print
|
9
9
|
@prefix = prefix
|
10
|
+
@suffix = suffix
|
10
11
|
end
|
11
12
|
|
12
13
|
protected
|
data/lib/i18n/js/segment.rb
CHANGED
@@ -7,7 +7,7 @@ module I18n
|
|
7
7
|
|
8
8
|
# Class which enscapulates a translations hash and outputs a single JSON translation file
|
9
9
|
class Segment
|
10
|
-
OPTIONS = [:namespace, :pretty_print, :js_extend, :prefix, :sort_translation_keys, :json_only].freeze
|
10
|
+
OPTIONS = [:namespace, :pretty_print, :js_extend, :prefix, :suffix, :sort_translation_keys, :json_only].freeze
|
11
11
|
LOCALE_INTERPOLATOR = /%\{locale\}/
|
12
12
|
|
13
13
|
attr_reader *([:file, :translations] | OPTIONS)
|
@@ -25,6 +25,7 @@ module I18n
|
|
25
25
|
@pretty_print = !!options[:pretty_print]
|
26
26
|
@js_extend = options.key?(:js_extend) ? !!options[:js_extend] : true
|
27
27
|
@prefix = options.key?(:prefix) ? options[:prefix] : nil
|
28
|
+
@suffix = options.key?(:suffix) ? options[:suffix] : nil
|
28
29
|
@sort_translation_keys = options.key?(:sort_translation_keys) ? !!options[:sort_translation_keys] : true
|
29
30
|
@json_only = options.key?(:json_only) ? !!options[:json_only] : false
|
30
31
|
end
|
@@ -70,7 +71,9 @@ module I18n
|
|
70
71
|
{ js_extend: @js_extend,
|
71
72
|
namespace: @namespace,
|
72
73
|
pretty_print: @pretty_print,
|
73
|
-
prefix: @prefix
|
74
|
+
prefix: @prefix,
|
75
|
+
suffix: @suffix
|
76
|
+
}
|
74
77
|
end
|
75
78
|
end
|
76
79
|
end
|
data/lib/i18n/js/version.rb
CHANGED
data/spec/ruby/i18n/js_spec.rb
CHANGED
@@ -351,7 +351,7 @@ EOS
|
|
351
351
|
end
|
352
352
|
end
|
353
353
|
|
354
|
-
context "namespace, prefix and pretty_print options" do
|
354
|
+
context "namespace, prefix, suffix, and pretty_print options" do
|
355
355
|
|
356
356
|
before do
|
357
357
|
stub_const('I18n::JS::DEFAULT_EXPORT_DIR_PATH', temp_path)
|
@@ -379,6 +379,7 @@ EOS
|
|
379
379
|
"foo": "Foo",
|
380
380
|
"fallback_test": "Success"
|
381
381
|
};
|
382
|
+
//test
|
382
383
|
EOS
|
383
384
|
}$/)
|
384
385
|
end
|
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.6.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:
|
11
|
+
date: 2020-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -126,6 +126,7 @@ files:
|
|
126
126
|
- gemfiles/i18n_1_5.gemfile
|
127
127
|
- gemfiles/i18n_1_6.gemfile
|
128
128
|
- gemfiles/i18n_1_7.gemfile
|
129
|
+
- gemfiles/i18n_1_8.gemfile
|
129
130
|
- i18n-js.gemspec
|
130
131
|
- lib/i18n-js.rb
|
131
132
|
- lib/i18n/js.rb
|