Aqara_localizable 0.0.1 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/Aqara_localizable/command/command_gen.rb +2 -1
- data/lib/Aqara_localizable/gem_version.rb +1 -1
- data/lib/{Aqara_localizable/cocoapods_plugin.rb → cocoapods_plugin.rb} +1 -1
- data/lib/script/ios_py_code/DownloadNewLanguage.py +10 -12
- data/lib/script/ios_py_code/ios_sp_str_generator.py +63 -58
- metadata +3 -3
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
|
@@ -26,9 +26,10 @@ module AqaraLocalizable
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def run
|
29
|
-
puts '
|
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
|
@@ -4,7 +4,7 @@ require 'Aqara_localizable'
|
|
4
4
|
module Pod
|
5
5
|
# hook
|
6
6
|
@HooksManager = HooksManager
|
7
|
-
@HooksManager.register('
|
7
|
+
@HooksManager.register('Aqara_localizable', :post_install) do |_, _options|
|
8
8
|
args = ['gen', "--project-directory=#{Config.instance.installation_root}"]
|
9
9
|
|
10
10
|
AqaraLocalizable::Command.run(args)
|
@@ -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')
|
@@ -84,64 +84,69 @@ def getfilter():
|
|
84
84
|
|
85
85
|
|
86
86
|
if __name__ == '__main__':
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
#
|
106
|
-
|
107
|
-
#
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
#
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
#
|
137
|
-
#
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
87
|
+
|
88
|
+
localizable_path = sys.argv[1]
|
89
|
+
target_path = f'{localizable_path}/AqaraHome'
|
90
|
+
DownloadNewLanguage.UpdateSource_language(target_path)
|
91
|
+
filepath = f'{target_path}/hit_all_str.xlsx'
|
92
|
+
|
93
|
+
platformUniteStrDict = file_util.readXlsxFileToDict(filepath)
|
94
|
+
print(len(platformUniteStrDict))
|
95
|
+
isIndexLan = False
|
96
|
+
if isIndexLan:
|
97
|
+
addIndex(platformUniteStrDict)
|
98
|
+
|
99
|
+
dirname = f'{target_path}/output_file/ios'
|
100
|
+
iosStringListPath = string_repeat_filter.generateIOSStringPathList(dirname)
|
101
|
+
|
102
|
+
|
103
|
+
[os.makedirs(os.path.dirname(x)) for x in iosStringListPath if not os.path.exists(os.path.dirname(x))]
|
104
|
+
|
105
|
+
# srcList = [cnXml, enXml,knXml,rnXml,twXml,hkXml,geXml,frXml,itXml,esXml]
|
106
|
+
|
107
|
+
# se.valueList = [chinese_simp,english,korea,russia,chinese_tw,chinese_hk,german,french,itay,spain]
|
108
|
+
|
109
|
+
iosFisList = [open(x,'w') for x in iosStringListPath]
|
110
|
+
for k in platformUniteStrDict:
|
111
|
+
item = platformUniteStrDict.get(k)
|
112
|
+
valueList = item.valueList
|
113
|
+
for str,ifis in zip(valueList,iosFisList):
|
114
|
+
# print(item.id)
|
115
|
+
|
116
|
+
if str == None:
|
117
|
+
continue
|
118
|
+
if str.__contains__(r'""'):
|
119
|
+
str = str.replace(r'""', r'"')
|
120
|
+
if str.__contains__(r'\"'):
|
121
|
+
str = str.replace(r'\"', r'"')
|
122
|
+
if str.__contains__(r'""'):
|
123
|
+
str = str.replace(r'""', r'"')
|
124
|
+
if str.__contains__(r'"') :
|
125
|
+
str = str.replace(r'"', r'\"')
|
126
|
+
|
127
|
+
if str.endswith('\\'):
|
128
|
+
str = str[0:-1]
|
129
|
+
|
130
|
+
if str.endswith('\\'):
|
131
|
+
str = str[0:-1]
|
132
|
+
iosStr = f'\"{k}\" = \"{str}\";\n'
|
133
|
+
ifis.write(iosStr)
|
134
|
+
|
135
|
+
for ifs in iosFisList:
|
136
|
+
# afis.write('</resources>')
|
137
|
+
# afis.close()
|
138
|
+
ifs.close()
|
139
|
+
|
140
|
+
codePath = f'{localizable_path}/AqaraHome/Common/Frameworks/LMFramework.bundle'
|
141
|
+
print(f'校对下替换的位置是否正确====={codePath}')
|
142
|
+
if os.path.exists(codePath):
|
143
|
+
copyLocalizedToDestPath(iosStringListPath,codePath)
|
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
|
+
|
145
150
|
|
146
151
|
|
147
152
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zhaoxifan
|
@@ -146,11 +146,11 @@ files:
|
|
146
146
|
- README.md
|
147
147
|
- bin/Aqaralocalizable
|
148
148
|
- lib/Aqara_localizable.rb
|
149
|
-
- lib/Aqara_localizable/cocoapods_plugin.rb
|
150
149
|
- lib/Aqara_localizable/command.rb
|
151
150
|
- lib/Aqara_localizable/command/command_gen.rb
|
152
151
|
- lib/Aqara_localizable/command/zxf.py
|
153
152
|
- lib/Aqara_localizable/gem_version.rb
|
153
|
+
- lib/cocoapods_plugin.rb
|
154
154
|
- lib/script/git_shell/addPrefix.sh
|
155
155
|
- lib/script/git_shell/android_git_clean.sh
|
156
156
|
- lib/script/git_shell/commit_push.sh
|
@@ -301,7 +301,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
301
301
|
- !ruby/object:Gem::Version
|
302
302
|
version: '0'
|
303
303
|
requirements: []
|
304
|
-
rubygems_version: 3.
|
304
|
+
rubygems_version: 3.3.26
|
305
305
|
signing_key:
|
306
306
|
specification_version: 4
|
307
307
|
summary: AqaraHome 多语言插件
|