phraseapp-in-context-editor-ruby 2.1.2 → 3.0.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09476e9967528243584d88b2eab3153a64e77e7c6287bb4044d93f5b8d7535b0'
|
4
|
+
data.tar.gz: cfbdb848d7157a8ca3214db1288c43790548e4bb834c016b9ee5dd8473340810
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fea36910dec30f4b064ebdf5b1d9a0a155db20edd586498606a8c1fc1e925c7360cbf13a152c9b592696658ea6f73997cce5d701eca853497f2f512f3cc88375
|
7
|
+
data.tar.gz: d0d529d0f425c97c992196448ac9c3865f688259b245db12dd7e4be9d1a2d9271f261b97f2e3ecc924402dbe50cd0e37789b97e3a0b8cb3ea938e9771d1c9498
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
# [3.0.0](https://github.com/phrase/phraseapp-in-context-editor-ruby/compare/v2.1.2...v3.0.0) (2024-05-21)
|
2
|
+
|
3
|
+
|
4
|
+
* BREAKING CHANGE: Use ruby 2.7 'Forward all arguments' syntax: (...) to forward arguments (#78) ([99ae28e](https://github.com/phrase/phraseapp-in-context-editor-ruby/commit/99ae28e2f6fea0ba2ba0eec6eca54a043e21d121)), closes [#78](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/78)
|
5
|
+
|
6
|
+
|
7
|
+
### BREAKING CHANGES
|
8
|
+
|
9
|
+
* Hash arguments will throw an error. Keyword arguments must be used instead.
|
10
|
+
|
1
11
|
## [2.1.2](https://github.com/phrase/phraseapp-in-context-editor-ruby/compare/v2.1.1...v2.1.2) (2024-05-21)
|
2
12
|
|
3
13
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
if defined?(I18n)
|
2
2
|
module I18n
|
3
3
|
class << self
|
4
|
-
def translate_with_phraseapp(
|
5
|
-
PhraseApp::InContextEditor.backend.translate(
|
4
|
+
def translate_with_phraseapp(...)
|
5
|
+
PhraseApp::InContextEditor.backend.translate(...)
|
6
6
|
end
|
7
7
|
alias_method :translate_without_phraseapp, :translate
|
8
8
|
alias_method :translate, :translate_with_phraseapp
|
@@ -9,41 +9,21 @@ module PhraseApp
|
|
9
9
|
self
|
10
10
|
end
|
11
11
|
|
12
|
-
def translate(
|
13
|
-
if to_be_translated_without_phraseapp?(
|
14
|
-
|
15
|
-
#
|
16
|
-
# This method uses keyword arguments.
|
17
|
-
# There is a breaking change in ruby that produces warning with ruby 2.7 and won't work as expected with ruby 3.0
|
18
|
-
# The "hash" parameter must be passed as keyword argument.
|
19
|
-
#
|
20
|
-
# Good:
|
21
|
-
# I18n.t(:salutation, :gender => 'w', :name => 'Smith')
|
22
|
-
# I18n.t(:salutation, **{ :gender => 'w', :name => 'Smith' })
|
23
|
-
# I18n.t(:salutation, **any_hash)
|
24
|
-
#
|
25
|
-
# Bad:
|
26
|
-
# I18n.t(:salutation, { :gender => 'w', :name => 'Smith' })
|
27
|
-
# I18n.t(:salutation, any_hash)
|
28
|
-
#
|
29
|
-
kw_args = args[1]
|
30
|
-
if kw_args.present?
|
31
|
-
I18n.translate_without_phraseapp(args[0], **kw_args)
|
32
|
-
else
|
33
|
-
I18n.translate_without_phraseapp(args[0])
|
34
|
-
end
|
12
|
+
def translate(...)
|
13
|
+
if to_be_translated_without_phraseapp?(...)
|
14
|
+
I18n.translate_without_phraseapp(...)
|
35
15
|
else
|
36
|
-
phraseapp_delegate_for(
|
16
|
+
phraseapp_delegate_for(...)
|
37
17
|
end
|
38
18
|
end
|
39
19
|
|
40
20
|
protected
|
41
21
|
|
42
|
-
def to_be_translated_without_phraseapp?(
|
43
|
-
PhraseApp::InContextEditor.disabled? || has_been_forced_to_resolve_with_phraseapp?(
|
22
|
+
def to_be_translated_without_phraseapp?(...)
|
23
|
+
PhraseApp::InContextEditor.disabled? || has_been_forced_to_resolve_with_phraseapp?(...)
|
44
24
|
end
|
45
25
|
|
46
|
-
def has_been_forced_to_resolve_with_phraseapp?(args)
|
26
|
+
def has_been_forced_to_resolve_with_phraseapp?(*args)
|
47
27
|
(args.last.is_a?(Hash) && args.last[:resolve] == false)
|
48
28
|
end
|
49
29
|
|
@@ -51,7 +31,7 @@ module PhraseApp
|
|
51
31
|
extract_normalized_key_from_args(args)
|
52
32
|
end
|
53
33
|
|
54
|
-
def phraseapp_delegate_for(args)
|
34
|
+
def phraseapp_delegate_for(*args)
|
55
35
|
key = given_key_from_args(args)
|
56
36
|
return nil unless present?(key)
|
57
37
|
|