phraseapp-in-context-editor-ruby 3.0.1 → 3.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 +7 -0
- data/lib/generators/phraseapp_in_context_editor/templates/phraseapp_in_context_editor.rb +4 -0
- data/lib/phraseapp-in-context-editor-ruby/backend_service.rb +8 -3
- data/lib/phraseapp-in-context-editor-ruby/config.rb +2 -1
- data/lib/phraseapp-in-context-editor-ruby/version.rb +1 -1
- data/lib/phraseapp-in-context-editor-ruby.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 900986756f3ba71519a83b5168774f3fbcccde7956535ced2a907e1a1725978c
|
4
|
+
data.tar.gz: 33ed4e6bc473b1b456a4955f5253aeb637864fde544968051f88d95948a21666
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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|
|