Aqara_localizable 0.0.3 → 0.0.5
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/Aqara_localizable/command/command_gen.rb +2 -2
- data/lib/Aqara_localizable/gem_version.rb +1 -1
- data/lib/script/ios_py_code/DownloadNewLanguage.py +10 -12
- data/lib/script/ios_py_code/ios_sp_str_generator.py +12 -6
- data/lib/script/util_code/file_util.py +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbf09c7da40f156a14ad3a0dbfdc5305ebac729efea9f0bdc8f2b6001661263e
|
4
|
+
data.tar.gz: b03412d3bd6aeb77abcfd6e9aec48fbbca7995198c2feb7e1841747a752b3fd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34f0034ad3d38935d4b98914e5285c518d1216c22e78b7a6f8d1675de844c820f8b2cae98278ece624115ba65f368edcfc5202b5c1aba1523f9d927048ad9a79
|
7
|
+
data.tar.gz: 57371e5c944b00fdb18e7579eade2d2cececf20a9281f53d5cf9b20a4f906f7f30b08dc63bb9a6003344a04ded75a124cdfe14dff681b96c57dc0ac026e9317e
|
@@ -4,7 +4,6 @@ module AqaraLocalizable
|
|
4
4
|
class Command
|
5
5
|
class Gen < Command
|
6
6
|
self.summary = '开始下载多语言平台的代码并替换项目多语言文件'
|
7
|
-
|
8
7
|
def initialize(argv)
|
9
8
|
super
|
10
9
|
project_directory = argv.option('project-directory')
|
@@ -28,7 +27,8 @@ module AqaraLocalizable
|
|
28
27
|
def run
|
29
28
|
puts '如果多语言脚本插件有问题可以找zxf看看'.green
|
30
29
|
target_path = Pathname.new(File.dirname(__FILE__)).realpath.parent.parent
|
31
|
-
|
30
|
+
puts target_path
|
31
|
+
# system "pip3 install requests;pip3 install openpyxl"
|
32
32
|
system "cd #{target_path}/script/ios_py_code;python3 ios_sp_str_generator.py #{@project_directory}"
|
33
33
|
# system 'cd /lib/script/ios_py_code;python3 ios_sp_str_generator.py'
|
34
34
|
end
|
@@ -34,26 +34,24 @@ def MakeHeader(headerText):
|
|
34
34
|
s = {x.split(':', 1)[0].strip() :x.split(':', 1)[1].strip() for x in s}
|
35
35
|
return s
|
36
36
|
|
37
|
-
def DownLatestLocalizableSource():
|
37
|
+
def DownLatestLocalizableSource(targetPath):
|
38
38
|
session = requests.Session()
|
39
39
|
headers = MakeHeader(myheader)
|
40
40
|
params = '{"projectIdList":[5],"langIds":[1,2,3,9,10,11,12,13,14,15],"fileTypeList":["excel"],"auditState":1,"valueState":0,"userId":"","value":"","tagIds":null,"bizUseTagIds":null,"pkeys":[]}'
|
41
41
|
response = session.post("https://intl-lang.aqara.com/v1.0/lumi/language/file/export", headers = headers, data=params, timeout=3)
|
42
|
-
with open(
|
42
|
+
with open(f'{targetPath}/localizable' + ".zip","wb") as code:
|
43
43
|
# 将 response 保存成本地文件
|
44
44
|
code.write(response.content)
|
45
45
|
code.close()
|
46
46
|
|
47
|
-
def Unzip():
|
48
|
-
f = zipfile.ZipFile(
|
47
|
+
def Unzip(targetPath):
|
48
|
+
f = zipfile.ZipFile(f'{targetPath}/localizable.zip', 'r') # 压缩文件位置
|
49
49
|
for file in f.namelist():
|
50
|
-
f.extract(file,
|
50
|
+
f.extract(file, targetPath) # 解压位置
|
51
51
|
f.close()
|
52
|
-
os.remove('
|
52
|
+
os.remove(f'{targetPath}/localizable.zip')
|
53
53
|
|
54
|
-
def UpdateSource_language():
|
55
|
-
DownLatestLocalizableSource()
|
56
|
-
Unzip()
|
57
|
-
os.rename('
|
58
|
-
shutil.copy('../hit_all_str.xlsx', '../source_language/hit_all_str.xlsx')
|
59
|
-
os.remove('../hit_all_str.xlsx')
|
54
|
+
def UpdateSource_language(targetPath):
|
55
|
+
DownLatestLocalizableSource(targetPath)
|
56
|
+
Unzip(targetPath)
|
57
|
+
os.rename(f'{targetPath}/excel.xls', f'{targetPath}/hit_all_str.xlsx')
|
@@ -86,17 +86,17 @@ def getfilter():
|
|
86
86
|
if __name__ == '__main__':
|
87
87
|
|
88
88
|
localizable_path = sys.argv[1]
|
89
|
-
|
90
|
-
DownloadNewLanguage.UpdateSource_language()
|
91
|
-
filepath = '
|
89
|
+
target_path = f'{localizable_path}/AqaraHome'
|
90
|
+
DownloadNewLanguage.UpdateSource_language(target_path)
|
91
|
+
filepath = f'{target_path}/hit_all_str.xlsx'
|
92
92
|
|
93
93
|
platformUniteStrDict = file_util.readXlsxFileToDict(filepath)
|
94
|
-
print(len(platformUniteStrDict))
|
94
|
+
print(f'\033[4;36m多语言Key总数:{len(platformUniteStrDict)}\033[0m')
|
95
95
|
isIndexLan = False
|
96
96
|
if isIndexLan:
|
97
97
|
addIndex(platformUniteStrDict)
|
98
98
|
|
99
|
-
dirname = '
|
99
|
+
dirname = f'{target_path}/output_file/ios'
|
100
100
|
iosStringListPath = string_repeat_filter.generateIOSStringPathList(dirname)
|
101
101
|
|
102
102
|
|
@@ -138,10 +138,16 @@ if __name__ == '__main__':
|
|
138
138
|
ifs.close()
|
139
139
|
|
140
140
|
codePath = f'{localizable_path}/AqaraHome/Common/Frameworks/LMFramework.bundle'
|
141
|
-
print(f'
|
141
|
+
print(f'\033[1;35m校对下替换的位置是否正确:{codePath}\033[0m')
|
142
142
|
if os.path.exists(codePath):
|
143
143
|
copyLocalizedToDestPath(iosStringListPath,codePath)
|
144
144
|
|
145
|
+
os.remove(f'{target_path}/hit_all_str.xlsx')
|
146
|
+
if os.path.exists(os.path.dirname(f'{target_path}/output_file')):
|
147
|
+
shutil.rmtree(f'{target_path}/output_file')
|
148
|
+
|
149
|
+
|
150
|
+
|
145
151
|
|
146
152
|
|
147
153
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Aqara_localizable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zhaoxifan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|