neeto-translate-cli 0.2.0 → 0.2.3
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e3799d5c89b393b28fb9e117a66a8c7fefb77637a4dec72d407b59dfd96ceb61
|
|
4
|
+
data.tar.gz: 3b2f25d784270467711707bec2ce99cdb8ee9e20744a1717c367dd0e8eb4c19f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9a912ecb65942edd2246c6f1464e52e466d306e0f455669108910bb3462bc31a1a3d158f57a69153848b1a7037aef2a293f92871ccb73de023e50523258c89aa
|
|
7
|
+
data.tar.gz: 971a96d55d8721ce5f3e2425e28ef515ea150522551b360f18c70c5dbf6f836cc84ea285656ea855a03def80b586c8bf0054330b5bf542720731c2b905b77669
|
|
@@ -16,14 +16,14 @@ module NeetoTranslateCli
|
|
|
16
16
|
def process!
|
|
17
17
|
{
|
|
18
18
|
frontend: {
|
|
19
|
-
en:
|
|
19
|
+
en: flatten_hash_with_prefix(frontend_translations[:en]),
|
|
20
20
|
missing_keys: find_missing_keys
|
|
21
21
|
},
|
|
22
22
|
metadata: {
|
|
23
23
|
repo: options[:repo],
|
|
24
24
|
frontend: options[:frontend],
|
|
25
25
|
strategy: options[:strategy],
|
|
26
|
-
branch: options[:branch]
|
|
26
|
+
branch: options[:branch]
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
end
|
|
@@ -41,7 +41,8 @@ module NeetoTranslateCli
|
|
|
41
41
|
def find_updated_keys(commit_id)
|
|
42
42
|
updated_frontend_keys = {}
|
|
43
43
|
frontend_translations[:en].each do |file_path, content|
|
|
44
|
-
|
|
44
|
+
lang_file_path = "#{options[:frontend]}/en/#{file_path}.json"
|
|
45
|
+
relative_path_from_pwd = Pathname.new(lang_file_path).to_s
|
|
45
46
|
previous_content = `git show #{commit_id}:#{relative_path_from_pwd}`
|
|
46
47
|
next if previous_content.empty?
|
|
47
48
|
|
|
@@ -55,10 +56,7 @@ module NeetoTranslateCli
|
|
|
55
56
|
|
|
56
57
|
next if updated_keys_for_file.empty?
|
|
57
58
|
|
|
58
|
-
|
|
59
|
-
.relative_path_from(Pathname.new(File.expand_path(File.join(options[:frontend], "en")))).to_s
|
|
60
|
-
path_without_ext = relative_path_from_en_dir.chomp(File.extname(relative_path_from_en_dir))
|
|
61
|
-
updated_frontend_keys[path_without_ext] = updated_keys_for_file
|
|
59
|
+
updated_frontend_keys[lang_file_path] = updated_keys_for_file
|
|
62
60
|
end
|
|
63
61
|
{ frontend: updated_frontend_keys }
|
|
64
62
|
end
|
|
@@ -76,7 +74,7 @@ module NeetoTranslateCli
|
|
|
76
74
|
lang_keys = File.file?(lang_file_path) ? flatten_hash(load_json(lang_file_path)).keys : []
|
|
77
75
|
|
|
78
76
|
missing_in_file = (base_keys - lang_keys).uniq
|
|
79
|
-
missing_keys[lang].concat(missing_in_file.map { |key| "#{base_file_path}
|
|
77
|
+
missing_keys[lang].concat(missing_in_file.map { |key| "#{base_file_path}::#{key}" })
|
|
80
78
|
end
|
|
81
79
|
end
|
|
82
80
|
|
|
@@ -114,10 +112,10 @@ module NeetoTranslateCli
|
|
|
114
112
|
end
|
|
115
113
|
end
|
|
116
114
|
|
|
117
|
-
def
|
|
115
|
+
def flatten_hash_with_prefix(hash)
|
|
118
116
|
hash.flat_map do |file_key, file_content|
|
|
119
117
|
flatten_hash(file_content).map do |translation_key, translation_value|
|
|
120
|
-
["#{file_key}
|
|
118
|
+
["#{file_key}::#{translation_key}", translation_value]
|
|
121
119
|
end
|
|
122
120
|
end.to_h
|
|
123
121
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: neeto-translate-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Abhay V Ashokan
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-09-
|
|
11
|
+
date: 2025-09-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|