Aqara_localizable 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e185047e44e6f2725b74df836dbe0b2de830e53dd5d85b1a6faef00a58875ef
|
4
|
+
data.tar.gz: cba3fa71759dc51d181472b7becc91f73b44b0c6fd16fc1076b75ae1186b9909
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecdc6009aee99d99997ad0f81de1c54c64d51aa13dd731e2ed06cffda39e7e291002ec1cc22b871892cdf91ad33f0c36602613f19bc1b1e99850f5a912fedfcc
|
7
|
+
data.tar.gz: 663a414aa2886f6cdaeee31f499cfbadd56180d13a7e77ddcfeae32c0afb440516aea2646847212100b740ff85fb0f308ab3c88d7d10379ba7ea200d4c8ece5a
|
@@ -28,7 +28,8 @@ module AqaraLocalizable
|
|
28
28
|
def run
|
29
29
|
puts '如果多语言脚本插件有问题可以找zxf看看'.green
|
30
30
|
target_path = Pathname.new(File.dirname(__FILE__)).realpath.parent.parent
|
31
|
-
|
31
|
+
puts target_path
|
32
|
+
# system "pip3 install requests;pip3 install openpyxl"
|
32
33
|
system "cd #{target_path}/script/ios_py_code;python3 ios_sp_str_generator.py #{@project_directory}"
|
33
34
|
# system 'cd /lib/script/ios_py_code;python3 ios_sp_str_generator.py'
|
34
35
|
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,9 +86,9 @@ 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
94
|
print(len(platformUniteStrDict))
|
@@ -96,7 +96,7 @@ if __name__ == '__main__':
|
|
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
|
|
@@ -142,6 +142,12 @@ if __name__ == '__main__':
|
|
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
|
|