cocoapods-aqara-localzedLoader 0.1.8 → 0.1.10
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/Gemfile.lock +1 -1
- data/lib/cocoapods-aqara-localzedLoader/DownloadNewLanguage.py +15 -0
- data/lib/cocoapods-aqara-localzedLoader/crowdin_util.rb +39 -0
- data/lib/cocoapods-aqara-localzedLoader/gem_version.rb +1 -1
- data/lib/cocoapods-aqara-localzedLoader/ios_bundle_generate.rb +6 -3
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 167b2858df9d98e8855bca0883bb307dc1b0872222f5b89af94768eb0d891751
|
|
4
|
+
data.tar.gz: 271e2b2ec483bf5fe8819dfad37140a010bff37800fcc7743adada74e3dad28d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a180839358effdd6b16cedc05590fabed5a30d69bc3b53ceafcc5382adb5674e1d1c58f72e24ac741666eb07701c4ae0cd85d77bf5f507dec9137451e160d6bc
|
|
7
|
+
data.tar.gz: 28b60ba42cfb8256add143695520f0f54577c7ab3c540cfcd246b7bf34c70ca282221bc6d5f9748cf66110e8d0f121f696d2f41783fe91c483a517d8667400bb
|
data/Gemfile.lock
CHANGED
|
@@ -177,6 +177,20 @@ class CrowdinPlatform():
|
|
|
177
177
|
resp.raise_for_status()
|
|
178
178
|
return resp.json()
|
|
179
179
|
|
|
180
|
+
def release_distribution(self, distribution_hash: str = "e-53615346e6d639beb7263b3iht") -> None:
|
|
181
|
+
"""
|
|
182
|
+
OTA 发布(真正让移动端拿到新文案)
|
|
183
|
+
"""
|
|
184
|
+
url = f"{self.base_url}/projects/{self.project_id}/distributions/{distribution_hash}/release"
|
|
185
|
+
print(f"🚀 OTA Release: distribution={distribution_hash}")
|
|
186
|
+
|
|
187
|
+
resp = requests.post(url, headers=self._get_headers(), json={})
|
|
188
|
+
resp.raise_for_status()
|
|
189
|
+
|
|
190
|
+
print("✅ OTA Release 成功")
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
180
194
|
def _find_directory_id_by_path(self, directory_path: str) -> int:
|
|
181
195
|
dirs = self._get_directories()
|
|
182
196
|
for item in dirs["data"]:
|
|
@@ -240,6 +254,7 @@ class CrowdinPlatform():
|
|
|
240
254
|
if chunk:
|
|
241
255
|
f.write(chunk)
|
|
242
256
|
print(f"多语言 ZIP 下载完成: {output_zip_path}")
|
|
257
|
+
# 创建 Release
|
|
243
258
|
|
|
244
259
|
def download_and_extract_translations(self, output_dir: str) -> None:
|
|
245
260
|
"""下载并解压整个多语言文件"""
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require "net/http"
|
|
3
|
+
require "uri"
|
|
4
|
+
require "json"
|
|
5
|
+
class CrowdinUtil
|
|
6
|
+
|
|
7
|
+
def crowdin_headers
|
|
8
|
+
{
|
|
9
|
+
"Authorization" => "Bearer db0506fb755d528c7b9b750e15174d3cfa483859488da978748ad6b9e34d13dc94d8716810a2f978",
|
|
10
|
+
"Content-Type" => "application/json"
|
|
11
|
+
}
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def release_distribution(distribution_hash = "e-53615346e6d639beb7263b3iht")
|
|
15
|
+
url = URI(
|
|
16
|
+
"https://aqara.crowdin.com/api/v2/projects/71/distributions/#{distribution_hash}/release"
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
puts "🚀 OTA Release: distribution=#{distribution_hash}"
|
|
20
|
+
|
|
21
|
+
http = Net::HTTP.new(url.host, url.port)
|
|
22
|
+
http.use_ssl = true
|
|
23
|
+
|
|
24
|
+
request = Net::HTTP::Post.new(url.request_uri)
|
|
25
|
+
crowdin_headers.each do |k, v|
|
|
26
|
+
request[k] = v
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
request.body = {}.to_json
|
|
30
|
+
|
|
31
|
+
response = http.request(request)
|
|
32
|
+
|
|
33
|
+
unless response.is_a?(Net::HTTPSuccess)
|
|
34
|
+
raise "Crowdin OTA Release failed: #{response.code} #{response.body}"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
puts "✅ OTA Release 成功"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
require_relative './LanguageDownloader'
|
|
3
3
|
require_relative './File_util'
|
|
4
|
+
require_relative './crowdin_util'
|
|
4
5
|
require 'fileutils'
|
|
5
6
|
require 'open3'
|
|
6
7
|
# require 'colored2'
|
|
@@ -90,7 +91,7 @@ class BundleGenerater
|
|
|
90
91
|
if File.exist? f_path
|
|
91
92
|
if crowdin
|
|
92
93
|
parent_dir = File.dirname(f_path)
|
|
93
|
-
FileUtils.rm_rf(parent_dir)
|
|
94
|
+
# FileUtils.rm_rf(parent_dir)
|
|
94
95
|
else
|
|
95
96
|
FileUtils.rm_rf f_path
|
|
96
97
|
end
|
|
@@ -115,7 +116,7 @@ class BundleGenerater
|
|
|
115
116
|
expected_count = nil
|
|
116
117
|
stringElement.langHash.each do |lang, value|
|
|
117
118
|
# puts "#{lang}:#{value}"
|
|
118
|
-
next if lang.downcase === "selfkey" or value === nil or value === " " or value === ""
|
|
119
|
+
next if lang.downcase === "selfkey" or lang.downcase === "context" or lang.downcase === "tag" or lang.downcase === "length limit" or value === nil or value === " " or value === ""
|
|
119
120
|
value = self.handleValue value,stringElement
|
|
120
121
|
current_count = value.scan(/%@/).size
|
|
121
122
|
|
|
@@ -227,7 +228,9 @@ class BundleGenerater
|
|
|
227
228
|
puts "InfoPlist多语言拷贝到目录:#{info_plist_path}"
|
|
228
229
|
end
|
|
229
230
|
if crowdin
|
|
230
|
-
system("crowdin upload --config #{project_path}/AqaraHome/Common/crowdin.yml --branch iOS_Localizable")
|
|
231
|
+
system("crowdin upload translations --config #{project_path}/AqaraHome/Common/crowdin.yml --branch iOS_Localizable")
|
|
232
|
+
crowdin_util = CrowdinUtil.new
|
|
233
|
+
crowdin_util.release_distribution
|
|
231
234
|
end
|
|
232
235
|
end
|
|
233
236
|
#对多语言的value进行处理
|
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.1.
|
|
4
|
+
version: 0.1.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- zhaoxifan
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-01-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -192,6 +192,7 @@ files:
|
|
|
192
192
|
- lib/cocoapods-aqara-localzedLoader/StringElement.rb
|
|
193
193
|
- lib/cocoapods-aqara-localzedLoader/command.rb
|
|
194
194
|
- lib/cocoapods-aqara-localzedLoader/command/localzedLoader.rb
|
|
195
|
+
- lib/cocoapods-aqara-localzedLoader/crowdin_util.rb
|
|
195
196
|
- lib/cocoapods-aqara-localzedLoader/excel_generate.rb
|
|
196
197
|
- lib/cocoapods-aqara-localzedLoader/gem_version.rb
|
|
197
198
|
- lib/cocoapods-aqara-localzedLoader/ios_bundle_generate.rb
|