cocoapods-aqara-localzedLoader 0.0.8 → 0.0.9

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: 0a4cfe3b8655489f905a84c91c571b067d9751be203a11ccd923a54696db9d2b
4
- data.tar.gz: 63dc9542c9ed8f33b533513c4d65c4020f6f0124f33282e981f4f8b8c7206352
3
+ metadata.gz: 70f7cdf4029ec8ec4a7a1b0f49700e141507fa80073509d21835b0c82e71ff94
4
+ data.tar.gz: 7d0dc878df2a7e977e0555adcb1a6b8e130f7b477c5cb984cc1d4ccc2221b8e8
5
5
  SHA512:
6
- metadata.gz: 82b82152b80545354bd58f8179672d6e4849de7b5d279dc490f01caa1055df9c66ad8a26e4137f8c1760488b3ff9010f6d8712aa7c1007e775251fb84686b11c
7
- data.tar.gz: 16e8ba489b6c4d4b685ccef6b714ad5742addb385eb30182f563af2d345d56b89a6667b5999dd944998fc9c2dc8b528667994709dbb2f15de69b8999b2e2d89a
6
+ metadata.gz: be02d3c670ea91b1883c6b2b4f45f2006d5abed9e867eeaa15fca706f56d997ae029e6f8d016996d2e8df57f172299fb8e0b60eb54832af6976ca52afdd57018
7
+ data.tar.gz: cb182f9cbc60eb5810d6736f8e34923b0f2dcb950c6d305f5bea1474af33e15775379d2c502107811d216a15bc83305006b42bbc60bc3be5d0bd3c71143038b6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocoapods-aqara-localzedLoader (0.0.8)
4
+ cocoapods-aqara-localzedLoader (0.0.9)
5
5
  claide (>= 1.0.2, < 2.0)
6
6
  colored2
7
7
  fileutils
@@ -1,3 +1,3 @@
1
1
  module Localzedloader
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -52,11 +52,17 @@ class BundleGenerater
52
52
  @@download_Count = 1
53
53
 
54
54
  def self.downloadxls(project_path)
55
+ if @@download_Count > 10
56
+ puts "当前无网络,程序即将退出。"
57
+ exit(1)
58
+ end
55
59
  if @@download_Count > 1
56
- sleep 10
60
+ base = 2
61
+ sleep_time = base * (2 ** (@@download_Count - 2))
62
+ puts "等待#{sleep_time}秒后重试..."
63
+ sleep sleep_time
57
64
  end
58
65
  puts "当前进行第#{@@download_Count}次尝试下载多语言文件"
59
- #Open3.capture3("cd #{File.dirname(__FILE__)};python3 DownloadNewLanguage.py #{project_path}")
60
66
  system "cd #{File.dirname(__FILE__)};python3 DownloadNewLanguage.py #{project_path}"
61
67
  @@download_Count = @@download_Count + 1
62
68
  end
@@ -72,7 +78,6 @@ class BundleGenerater
72
78
  until File.exist?(f_path)
73
79
  self.downloadxls(project_path)
74
80
  end
75
-
76
81
  # 读取excel到内存
77
82
  file_til = File_util.new
78
83
  hash = file_til.read_excel f_path
@@ -93,18 +98,26 @@ class BundleGenerater
93
98
 
94
99
  end
95
100
 
101
+ errors = []
96
102
  #生成资源文件
97
103
  hash.each do |key, stringElement|
98
- num = 0
104
+ expected_count = nil
99
105
  stringElement.langHash.each do |lang, value|
100
106
  # puts "#{lang}:#{value}"
101
107
  next if lang.downcase === "selfkey" or value === nil or value === " " or value === ""
102
108
  value = self.handleValue value,stringElement
103
- value.scan(/%@/) do |match|
104
- num = match.size if num == 0
105
- if num != match.size
106
- puts "key:#{key}中%@ 数量不一致,请检查".red
107
- end
109
+ current_count = value.scan(/%@/).size
110
+
111
+ if expected_count.nil?
112
+ expected_count = current_count
113
+ elsif current_count != expected_count
114
+ errors << {
115
+ key: key,
116
+ lang: lang,
117
+ expected: expected_count,
118
+ actual: current_count
119
+ }
120
+ next
108
121
  end
109
122
  str = %Q|"#{key}" = "#{value}";\n|
110
123
  localized_file = "./#{lang}.lproj/Localizable.strings"
@@ -138,6 +151,17 @@ class BundleGenerater
138
151
  end
139
152
  end
140
153
 
154
+ #判读是否有多语言出现不同语种%@数量不匹配,出现后中断打包
155
+ if errors.any?
156
+ puts "以下 key 的 %@ 在不同语种的数量存在不一致,让产品交互速度改后再打包:\n".red
157
+ errors.each do |err|
158
+ puts "key: #{err[:key]} | 语言: #{err[:lang]} | 实际: #{err[:actual]} | 应为: #{err[:expected]}".red
159
+ end
160
+ exit(1)
161
+ else
162
+ puts "✅ 所有 key 的 %@ 在不同语种保持数量一致".green
163
+ end
164
+
141
165
  #验证导出的多语言包格式是否正确
142
166
  puts '开始校验多语言包格式'.red
143
167
  # puts "\e[31m 开始校验多语言包格式\e[0m"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-aqara-localzedLoader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - zhaoxifan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-22 00:00:00.000000000 Z
11
+ date: 2025-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler