neeto-translate-cli 0.2.6 → 0.2.8

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: d922fc3775bd0a0978906c7708d87f471924dfb7dc5c2aae6d2f30b834ab7fb9
4
- data.tar.gz: 42e12a05f52b40db7696078c8d084bf5b34e5e113461f111879a55d24db1059f
3
+ metadata.gz: 7d1e43201f183d061de8314572b0cfbd0d2e056a8ab780876a3b40bac078aa4a
4
+ data.tar.gz: 5d4e21c9a5d2c0d10b9ef3c0877dec6f674764a998511e96a27b56da9eaebce5
5
5
  SHA512:
6
- metadata.gz: 43f3a5bc321b6573be46fb98c435e755bc5592187e13dca42809f3d2427fdcd642e688dbc1ff0ca7e9d02590277b48099321c9d5a1148169e4863b83b5bbc635
7
- data.tar.gz: 907191c3f1713826fcb0fde9a87efd923e7a9f7dc483606bdcebec746007749bff248879e5374677034f8744e0d9dc3b9e4f8717ea0a926ae85dd2767e555ebd
6
+ metadata.gz: ac523a25c9ba9af2261d7581fb8375dbea96f8d3b1b7dbabb2b9f3beff706315def2f1a0dea47acbdfc5493db5d3ca95bd40e50ea3eadbab9f4a3019df21c36f
7
+ data.tar.gz: d29dbcd350471c4c3908c0394d57a7fd5fc9b520ba55c649a5416c29951fbcb789394715f59d24908da7b6da18a2aa88d5a7af3b2e2a25a113b4496afd428cdb
@@ -10,7 +10,7 @@ module NeetoTranslateCli
10
10
  def initialize(options)
11
11
  @options = options
12
12
  commit_id = git_commit_id
13
- @updated_keys = commit_id.empty? ? { frontend: {} } : find_updated_keys(commit_id)
13
+ @updated_keys = commit_id.empty? ? [] : find_updated_keys(commit_id)
14
14
  end
15
15
 
16
16
  def process!
@@ -39,7 +39,7 @@ module NeetoTranslateCli
39
39
  end
40
40
 
41
41
  def find_updated_keys(commit_id)
42
- updated_frontend_keys = {}
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
45
  relative_path_from_pwd = Pathname.new(lang_file_path).to_s
@@ -56,29 +56,25 @@ module NeetoTranslateCli
56
56
 
57
57
  next if updated_keys_for_file.empty?
58
58
 
59
- updated_frontend_keys[lang_file_path] = updated_keys_for_file
59
+ updated_frontend_keys.concat(updated_keys_for_file.map { |key| "#{file_path}::#{key}" })
60
60
  end
61
- { frontend: updated_frontend_keys }
61
+
62
+ updated_frontend_keys
62
63
  end
63
64
 
64
65
  def find_missing_keys
65
- missing_keys = {}
66
66
  base_translations = frontend_translations[:en]
67
67
 
68
- options[:default_languages].each do |lang|
69
- missing_keys[lang] = []
70
- base_translations.each do |base_file_path, base_content|
68
+ options[:default_languages].each_with_object({}) do |lang, missing_keys|
69
+ missing_keys[lang] = base_translations.flat_map do |base_file_path, base_content|
71
70
  lang_file_path = "#{options[:frontend]}/#{lang}/#{base_file_path}.json"
72
71
 
73
72
  base_keys = flatten_hash(base_content).keys
74
73
  lang_keys = File.file?(lang_file_path) ? flatten_hash(load_json(lang_file_path)).keys : []
75
74
 
76
- missing_in_file = (base_keys - lang_keys).uniq
77
- missing_keys[lang].concat(missing_in_file.map { |key| "#{base_file_path}::#{key}" })
78
- end
75
+ (base_keys - lang_keys).map { |key| "#{base_file_path}::#{key}" } + updated_keys
76
+ end.uniq
79
77
  end
80
-
81
- missing_keys
82
78
  end
83
79
 
84
80
  def frontend_translations
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NeetoTranslateCli
4
- VERSION = "0.2.6"
4
+ VERSION = "0.2.8"
5
5
  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.6
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abhay V Ashokan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-09-25 00:00:00.000000000 Z
11
+ date: 2025-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -62,7 +62,7 @@ licenses: []
62
62
  metadata:
63
63
  homepage_uri: https://github.com/neetozone/neeto-translate
64
64
  source_code_uri: https://github.com/neetozone/neeto-translate
65
- post_install_message:
65
+ post_install_message:
66
66
  rdoc_options: []
67
67
  require_paths:
68
68
  - lib
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  version: '0'
79
79
  requirements: []
80
80
  rubygems_version: 3.5.16
81
- signing_key:
81
+ signing_key:
82
82
  specification_version: 4
83
83
  summary: neeto-translate CLI tool to extract translation files and make requests to
84
84
  the neeto-translate API