messageformat-wrapper 1.0.0 → 1.1.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/CHANGELOG.md +4 -0
- data/lib/messageformat/version.rb +1 -1
- data/lib/messageformat.rb +6 -5
- 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: a4c6e303c49754420a1966b34985b4041186169f1b1aafbc74bad3d76ed6b9c9
|
4
|
+
data.tar.gz: d8718f1eeb58bde7a160b77cbff6ce3b5c832a3da922344c2f982a65def19c21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71a3ae1eeb14e84c93e750f5ff6ef5f3e449bd14a5506979d19ab526e64f25f765b47cf0c6d1f6f2d79a556cd683e1cb1b3395cfc18fef772b21be6dc8be10c4
|
7
|
+
data.tar.gz: 6808358dc264b6264d3d58b0446481f9d8be960349f9083c8063584d65edf5e0e666eeb57f539d61113d79265fc56feb836fc6b91be4b0acf27af231f1151d17
|
data/CHANGELOG.md
CHANGED
data/lib/messageformat.rb
CHANGED
@@ -12,16 +12,17 @@ module MessageFormat
|
|
12
12
|
class CompileError < StandardError
|
13
13
|
end
|
14
14
|
|
15
|
-
attr_reader :locale, :messages, :context
|
15
|
+
attr_reader :locale, :messages, :context, :strict
|
16
16
|
|
17
|
-
def initialize(locale, messages)
|
17
|
+
def initialize(locale, messages, strict: true)
|
18
18
|
@locale = locale
|
19
19
|
@messages = messages
|
20
|
+
@strict = strict
|
20
21
|
@context = init_context
|
21
22
|
end
|
22
23
|
|
23
24
|
def compile
|
24
|
-
context.call("compileMessageFormat", locale, messages)
|
25
|
+
context.call("compileMessageFormat", locale, messages, strict)
|
25
26
|
rescue MiniRacer::RuntimeError => e
|
26
27
|
raise CompileError.new(cause: e)
|
27
28
|
end
|
@@ -35,8 +36,8 @@ module MessageFormat
|
|
35
36
|
context.load(File.expand_path("../dist/messageformat.js", __dir__))
|
36
37
|
context.load(File.expand_path("../dist/compilemodule.js", __dir__))
|
37
38
|
context.eval(<<~JS)
|
38
|
-
function compileMessageFormat(locale, messages) {
|
39
|
-
const mf = new MessageFormat(locale);
|
39
|
+
function compileMessageFormat(locale, messages, strict) {
|
40
|
+
const mf = new MessageFormat(locale, { strictPluralKeys: strict });
|
40
41
|
return compileModule(mf, messages);
|
41
42
|
}
|
42
43
|
JS
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: messageformat-wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Loïc Guitaut
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mini_racer
|