awesome_translations 0.0.46 → 0.0.47

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
  SHA1:
3
- metadata.gz: 0ede80cd9136d6519b2822104add20536347399f
4
- data.tar.gz: eed9faf56e564db0a3646591543599239556e8a6
3
+ metadata.gz: 42ce40ffcca886ee6c5519d96837791db4aa1a26
4
+ data.tar.gz: f2d48e40304976711c8a7c4bbc32e177584a9111
5
5
  SHA512:
6
- metadata.gz: 15a4def2a4bb3b2f01970614b18ebee50e76cbe3d33913213fce7d09b7771aabdb2491cc4218c57e1014c5ff8344f29d454d0295d54c987a6e50da12fabaf10e
7
- data.tar.gz: a8279f5f668e0fc9f93c376c84081e35b3c35c532b33894946fdd497de122082069353bb259aa500ca61e4db85fb19b422362f5f8ca510afd17f94ff56c0889a
6
+ metadata.gz: bcb9c89b029d63fe19046218f7861a8358101b755f13e91a4407682d63c8a11796f10b73e9f5bda45b53968e0055d00ed82eaa4e0ede8becca83fdaf5126bcba
7
+ data.tar.gz: df6597660e6cf0e209a85d2edaa7d36dfc50d43b146fbcce6fb7a03285953259eb4a8db4c9d8edf786f08f822e11315d5573c0e59e329e6db7f0d88d6ca52a64
@@ -53,6 +53,14 @@ private
53
53
  line.scan(/\'([^\']+?)\'\s+\|\s+t\s*(\%}|\}\})/) do |match|
54
54
  add_translation(line_no, "t", match[0], translations_found, yielder)
55
55
  end
56
+
57
+ line.scan(/\"([^\"]+?)\"\s+\|\s+val:\s*\"([^\"]+?)\"\s*,\s*(.+?)\s*\|\s+t\s*/) do |match|
58
+ add_translation(line_no, "t", match[0], translations_found, yielder)
59
+ end
60
+
61
+ line.scan(/'([^\"]+?)'\s+\|\s+val:\s*'([^\"]+?)'\s*,\s*(.+?)\s*\|\s+t\s*/) do |match|
62
+ add_translation(line_no, "t", match[0], translations_found, yielder)
63
+ end
56
64
  end
57
65
 
58
66
  def parse_content(line_no, line, translations_found, yielder)
@@ -1,3 +1,3 @@
1
1
  module AwesomeTranslations
2
- VERSION = "0.0.46".freeze
2
+ VERSION = "0.0.47".freeze
3
3
  end
@@ -1,3 +1,5 @@
1
1
  <h1>{{ ".edit_user" | t }}</h1>
2
2
 
3
3
  {{ '.test_for_liquid_templates' | t }}
4
+ {{ ".test_for_liquid_templates_with_var_double_quotes" | val: "something", something | t }}
5
+ {{ '.test_for_liquid_templates_with_var_single_quotes' | val: 'something', something | t }}
@@ -10,6 +10,7 @@ describe AwesomeTranslations::ErbInspector::FileInspector do
10
10
  let(:files) { erb_inspector.files.to_a }
11
11
  let(:file_paths) { files.map(&:file_path) }
12
12
  let(:user_index_inspector) { files.find { |file_inspector| file_inspector.file_path == "app/views/users/index.html.haml" } }
13
+ let(:user_edit_inspector) { files.find { |file_inspector| file_inspector.file_path == "app/views/users/edit.html.liquid" } }
13
14
  let(:user_index_translations) { user_index_inspector.translations.to_a }
14
15
  let(:hello_world_translation) { user_index_translations.find { |translation| translation.key == ".hello_world" } }
15
16
 
@@ -17,5 +18,14 @@ describe AwesomeTranslations::ErbInspector::FileInspector do
17
18
  it "finds the right number of translations" do
18
19
  expect(user_index_translations.length).to eq 3
19
20
  end
21
+
22
+ it "finds liquid translations" do
23
+ translation_keys = user_edit_inspector.translations.map(&:key)
24
+
25
+ expect(translation_keys).to include ".edit_user"
26
+ expect(translation_keys).to include ".test_for_liquid_templates"
27
+ expect(translation_keys).to include ".test_for_liquid_templates_with_var_double_quotes"
28
+ expect(translation_keys).to include ".test_for_liquid_templates_with_var_single_quotes"
29
+ end
20
30
  end
21
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awesome_translations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.46
4
+ version: 0.0.47
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasper Johansen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-01 00:00:00.000000000 Z
11
+ date: 2017-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: array_enumerator