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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c46becbfc85a8a93dad68b5dc56c57f49199db1b2e850435323219e3e74ecb03
4
- data.tar.gz: e59561ec34d12cd4c27f161e4ad53c61acc1e229eb4bdfe8d17eacc235b8b5b5
3
+ metadata.gz: a4c6e303c49754420a1966b34985b4041186169f1b1aafbc74bad3d76ed6b9c9
4
+ data.tar.gz: d8718f1eeb58bde7a160b77cbff6ce3b5c832a3da922344c2f982a65def19c21
5
5
  SHA512:
6
- metadata.gz: fc0b838ba2d8d7132863509efe815b72f6c2f8ec914c641492c4302bbbc442fc16a252bd36811d4350f9ac75da525f990e2e87710c25b5a3e3c2d0be40a5cc2b
7
- data.tar.gz: 82228aa62d6c9d48d44982143a39684c89d222c99b3a5ac4c54fe1ff0d9b0c547a2e7f05fea8ead1d7cc60e9f7143805fe1ca8f543ae4af48017810d50e8f6b2
6
+ metadata.gz: 71a3ae1eeb14e84c93e750f5ff6ef5f3e449bd14a5506979d19ab526e64f25f765b47cf0c6d1f6f2d79a556cd683e1cb1b3395cfc18fef772b21be6dc8be10c4
7
+ data.tar.gz: 6808358dc264b6264d3d58b0446481f9d8be960349f9083c8063584d65edf5e0e666eeb57f539d61113d79265fc56feb836fc6b91be4b0acf27af231f1151d17
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.1.0] — 2024-07-25
4
+
5
+ - FEATURE: Allow invalid plural keys
6
+
3
7
  ## [1.0.0] - 2024-06-17
4
8
 
5
9
  - Initial release
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MessageFormat
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
  end
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.0.0
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-06-19 00:00:00.000000000 Z
11
+ date: 2024-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mini_racer