i18n_screwdriver 10.2.1 → 10.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/lib/i18n_screwdriver.rb +3 -3
- data/lib/i18n_screwdriver/version.rb +1 -1
- data/spec/i18n_screwdriver_spec.rb +10 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b25ce8143c4f385ce9a6bad32aa3b2815cd8e46d37006daed51678f5dc8ce7f9
|
4
|
+
data.tar.gz: fb807641974f1c8887c6cf5c391abd9a156b05e346d446e70506b8d12679c3aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0abff174472e13e311a9cc5690eb3dbc8198c45ff17ddc5179329f17cf0adf535c96d09003bc1c2b0edf05685d95a6f84cece1a974e0fc8359f3026f275d8ec3
|
7
|
+
data.tar.gz: efa90ec1fa82afbc8913360616410dfb9c96bb0bbd045c57d72087523281592ebd75cb712d6c77cb217b300e97ac5ea5f82f50c07e2fd6436ff7a68350530eeb
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.6.1
|
data/lib/i18n_screwdriver.rb
CHANGED
@@ -55,9 +55,9 @@ module I18nScrewdriver
|
|
55
55
|
|
56
56
|
def self.grab_js_texts_to_be_translated(string)
|
57
57
|
[].tap do |texts|
|
58
|
-
texts.concat(string.scan(/\bI18n\.screw\(?\s*(?<!\\)"(.*?)(?<!\\)"/).map{ |v| unescape_string(v[0]) })
|
59
|
-
texts.concat(string.scan(/\bI18n\.screw\(?\s*(?<!\\)'(.*?)(?<!\\)'/).map{ |v| unescape_string(v[0]) })
|
60
|
-
texts.concat(string.scan(/\bI18n\.screw\(?\s*(?<!\\)`(.*?)(?<!\\)`/).map{ |v| unescape_string(v[0]) })
|
58
|
+
texts.concat(string.scan(/\bI18n\.screw\w*\(?\s*(?<!\\)"(.*?)(?<!\\)"/).map{ |v| unescape_string(v[0]) })
|
59
|
+
texts.concat(string.scan(/\bI18n\.screw\w*\(?\s*(?<!\\)'(.*?)(?<!\\)'/).map{ |v| unescape_string(v[0]) })
|
60
|
+
texts.concat(string.scan(/\bI18n\.screw\w*\(?\s*(?<!\\)`(.*?)(?<!\\)`/).map{ |v| unescape_string(v[0]) })
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
@@ -37,4 +37,14 @@ describe I18nScrewdriver do
|
|
37
37
|
expect(I18nScrewdriver.translate(:intro_text)).to eq("un lungo testo introduttivo")
|
38
38
|
end
|
39
39
|
end
|
40
|
+
|
41
|
+
describe "grab_js_texts_to_be_translated with screw based method" do
|
42
|
+
it "properly parses the passed string" do
|
43
|
+
expect(I18nScrewdriver.grab_js_texts_to_be_translated(%|=I18n.screwBasedMethod("test!")|)).to eq(["test!"])
|
44
|
+
expect(I18nScrewdriver.grab_js_texts_to_be_translated(%|=I18n.screwBasedMethod( "test!")|)).to eq(["test!"])
|
45
|
+
expect(I18nScrewdriver.grab_js_texts_to_be_translated(%|=I18n.screwBasedMethod("Hi %{name}!", name: "gucki")|)).to eq(["Hi %{name}!"])
|
46
|
+
expect(I18nScrewdriver.grab_js_texts_to_be_translated(%|=I18n.screwBasedMethod "test!"|)).to eq(["test!"])
|
47
|
+
expect(I18nScrewdriver.grab_js_texts_to_be_translated(%|=I18n.screwBasedMethod "Hi %{name}!", name: "gucki"|)).to eq(["Hi %{name}!"])
|
48
|
+
end
|
49
|
+
end
|
40
50
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n_screwdriver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 10.
|
4
|
+
version: 10.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Miesel
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-02-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -104,8 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
104
|
- !ruby/object:Gem::Version
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
|
-
|
108
|
-
rubygems_version: 2.7.3
|
107
|
+
rubygems_version: 3.0.1
|
109
108
|
signing_key:
|
110
109
|
specification_version: 4
|
111
110
|
summary: make translating with rails i18n fun again
|