phraseapp-in-context-editor-ruby 3.0.1 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 959f0ae7643190cc4795de334ab0d9b64fb52486b1de166ccdcfab9d50f29c78
4
- data.tar.gz: c12667b6c1da8dea65ff830647828c34216d723de98c815e6628265d639e1e7b
3
+ metadata.gz: 900986756f3ba71519a83b5168774f3fbcccde7956535ced2a907e1a1725978c
4
+ data.tar.gz: 33ed4e6bc473b1b456a4955f5253aeb637864fde544968051f88d95948a21666
5
5
  SHA512:
6
- metadata.gz: 5e7f7de78f617562fe35effa1162c97d5dc0b938549155ed5ff9d6223821f3380bc361956c5b78d00c5d8a2470bc6802ea8cc2a97989d0c93c880f5188d1904b
7
- data.tar.gz: 8467589b50d701dd648efe7546cce5b3680f282b3545ed11f698d9424438f4721e69be95ffee7e16ef972db0f7525c83df397c2d494611155069fb6b2eb05e3a
6
+ metadata.gz: 4eb5593cd10987c04b61726aa051b6c962b3b1f2bf83841f1ab0c3f80c319881cf71517f47a5f1c2ca3c73c6e4d86eca90532b87f476b887a11c3b72bdae255e
7
+ data.tar.gz: 0eed67e1f200e262044f3cb936f3e88c1f1bea485565345ad3a24f1f6ca34109a61b20878500f6911b12f9d69e81f2eac0b8dcfa26784dddeaf673b2008d821a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [3.1.0](https://github.com/phrase/phraseapp-in-context-editor-ruby/compare/v3.0.1...v3.1.0) (2024-06-14)
2
+
3
+
4
+ ### Features
5
+
6
+ * Add config option to ignore keys ([#82](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/82)) ([657b9f3](https://github.com/phrase/phraseapp-in-context-editor-ruby/commit/657b9f3ebce1ca2a364af1b9b84b0b28ee733983))
7
+
1
8
  ## [3.0.1](https://github.com/phrase/phraseapp-in-context-editor-ruby/compare/v3.0.0...v3.0.1) (2024-06-14)
2
9
 
3
10
 
@@ -9,6 +9,10 @@ PhraseApp::InContextEditor.configure do |config|
9
9
  config.account_id = "<%= options[:account_id] %>"
10
10
  config.datacenter = "eu"
11
11
 
12
+ # Configure an array of key names that should not be handled
13
+ # by the In-Context-Editor.
14
+ # config.ignored_keys = ["number.*", "foo.bar"]
15
+
12
16
  # Phrase uses decorators to generate a unique identification key
13
17
  # in context of your document. However, this might result in conflicts
14
18
  # with other libraries (e.g. client-side template engines) that use a similar syntax.
@@ -3,8 +3,6 @@ require_relative "delegate/i18n_delegate"
3
3
  module PhraseApp
4
4
  module InContextEditor
5
5
  class BackendService
6
- attr_accessor :blacklisted_keys
7
-
8
6
  def initialize(args = {})
9
7
  self
10
8
  end
@@ -20,7 +18,14 @@ module PhraseApp
20
18
  protected
21
19
 
22
20
  def to_be_translated_without_phraseapp?(...)
23
- PhraseApp::InContextEditor.disabled? || has_been_forced_to_resolve_with_phraseapp?(...)
21
+ PhraseApp::InContextEditor.disabled? || ignored_key?(...) || has_been_forced_to_resolve_with_phraseapp?(...)
22
+ end
23
+
24
+ def ignored_key?(*args)
25
+ key = given_key_from_args(args)
26
+ PhraseApp::InContextEditor.ignored_keys.any? do |ignored_key|
27
+ key.to_s[/\A#{ignored_key.gsub("*", ".*")}\Z/]
28
+ end
24
29
  end
25
30
 
26
31
  def has_been_forced_to_resolve_with_phraseapp?(*args)
@@ -9,7 +9,8 @@ module PhraseApp
9
9
  backend: PhraseApp::InContextEditor::BackendService.new,
10
10
  prefix: "{{__",
11
11
  suffix: "__}}",
12
- origin: "in-context-editor-ruby"
12
+ origin: "in-context-editor-ruby",
13
+ ignored_keys: []
13
14
  }.freeze
14
15
 
15
16
  CONFIG_OPTIONS.each do |option, default_value|
@@ -1,3 +1,3 @@
1
1
  module PhraseappInContextEditor
2
- VERSION = "3.0.1"
2
+ VERSION = "3.1.0"
3
3
  end
@@ -37,6 +37,10 @@ module PhraseApp
37
37
  config.datacenter
38
38
  end
39
39
 
40
+ def ignored_keys
41
+ config.ignored_keys
42
+ end
43
+
40
44
  def enabled=(value)
41
45
  config.enabled = value
42
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phraseapp-in-context-editor-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phrase