extract_i18n 0.7.2 → 0.8.1
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/lib/extract_i18n/file_processor.rb +1 -1
- data/lib/extract_i18n/html_extractor/erb_document.rb +9 -3
- data/lib/extract_i18n/html_extractor/match/node_match.rb +4 -0
- data/lib/extract_i18n/slimkeyfy/slim_transformer.rb +3 -1
- data/lib/extract_i18n/source_change.rb +4 -4
- data/lib/extract_i18n/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d8ad8ad587b0c1b29c6da66a422145d8863cf8ab3d427c96a689412b33de731
|
4
|
+
data.tar.gz: d56c08e023298fab0d2fc897ed318d6e994a78432ceb8630f386ae212c941c9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c7abee0591c99c71382fd5bf1cc244ccecbcc143e64024c012ddf0ea1d9b76614dd893dcc334cff547cafa3c163ac9dcbe799d16b7e9597ccbeccddd11b65fe
|
7
|
+
data.tar.gz: 6b11f294e3123b136027d4e79b4f7f887fbeae7d41c15fb8e23e3b7d0382e8793da054c734a9f1b6866323f40e1bdff89df2caa02273dc1cceeb59dc49174528
|
@@ -70,9 +70,15 @@ module ExtractI18n
|
|
70
70
|
|
71
71
|
ERB_REGEXPS.each do |regexp|
|
72
72
|
regexp.replace!(text) do |string_format, data|
|
73
|
-
|
74
|
-
|
75
|
-
|
73
|
+
code = data[:inner_text].strip
|
74
|
+
# skip t(...) / I18n.t(...) calls
|
75
|
+
if code =~ /\A(?:I18n\.)?t\(\s*(['"]).+?\1\s*\)\z/
|
76
|
+
"<%=#{data[:inner_text]}%>"
|
77
|
+
else
|
78
|
+
key = SecureRandom.uuid
|
79
|
+
erb_directives[key] = data[:inner_text]
|
80
|
+
string_format % { inner_text: key }
|
81
|
+
end
|
76
82
|
end
|
77
83
|
end
|
78
84
|
erb_directives
|
@@ -93,7 +93,9 @@ module ExtractI18n
|
|
93
93
|
t_template: "#{before}#{html_tag}t('%s'%s)#{after}"
|
94
94
|
)
|
95
95
|
final_line = yield(change)
|
96
|
-
|
96
|
+
if final_line != @word.indentation + line
|
97
|
+
return parse_html_arguments(final_line, &block)
|
98
|
+
end
|
97
99
|
end
|
98
100
|
end
|
99
101
|
if final_line == line
|
@@ -34,7 +34,7 @@ module ExtractI18n
|
|
34
34
|
@i18n_string = i18n_string
|
35
35
|
@key = i18n_key
|
36
36
|
@interpolate_arguments = interpolate_arguments
|
37
|
-
@source_line = source_line
|
37
|
+
@source_line = source_line.nil? ? "" : source_line
|
38
38
|
@remove = remove
|
39
39
|
@t_template = t_template
|
40
40
|
@interpolation_type = interpolation_type
|
@@ -42,9 +42,9 @@ module ExtractI18n
|
|
42
42
|
|
43
43
|
def format
|
44
44
|
s = ""
|
45
|
-
s += PASTEL.cyan("
|
45
|
+
s += PASTEL.cyan("\nreplace: ") + PASTEL.blue(@source_line).
|
46
46
|
gsub(@remove, PASTEL.red(@remove))
|
47
|
-
unless @source_line.
|
47
|
+
unless @source_line.end_with?("\n")
|
48
48
|
s += "\n"
|
49
49
|
end
|
50
50
|
if @source_line[@remove]
|
@@ -53,7 +53,7 @@ module ExtractI18n
|
|
53
53
|
else
|
54
54
|
s += PASTEL.cyan("with: ") + PASTEL.green(i18n_t)
|
55
55
|
end
|
56
|
-
unless @source_line.
|
56
|
+
unless @source_line.end_with?("\n")
|
57
57
|
s += "\n"
|
58
58
|
end
|
59
59
|
s += PASTEL.cyan("add i18n: ") + PASTEL.blue("#{@key}: #{@i18n_string}")
|
data/lib/extract_i18n/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extract_i18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Wienert
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -164,7 +164,7 @@ licenses:
|
|
164
164
|
- MIT
|
165
165
|
metadata:
|
166
166
|
rubygems_mfa_required: 'true'
|
167
|
-
post_install_message:
|
167
|
+
post_install_message:
|
168
168
|
rdoc_options: []
|
169
169
|
require_paths:
|
170
170
|
- lib
|
@@ -179,8 +179,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
requirements: []
|
182
|
-
rubygems_version: 3.
|
183
|
-
signing_key:
|
182
|
+
rubygems_version: 3.2.33
|
183
|
+
signing_key:
|
184
184
|
specification_version: 4
|
185
185
|
summary: Extact i18n from Ruby files using Ruby parser and slim files using regex
|
186
186
|
test_files: []
|