cocoapods-aqara-localzedLoader 0.0.1
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 +7 -0
- data/.gitignore +3 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +178 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +22 -0
- data/README.md +1 -0
- data/Rakefile +13 -0
- data/cocoapods-aqara-localzedLoader.gemspec +32 -0
- data/lib/cocoapods-aqara-localzedLoader/DownloadNewLanguage.py +102 -0
- data/lib/cocoapods-aqara-localzedLoader/File_util.rb +83 -0
- data/lib/cocoapods-aqara-localzedLoader/LanguageDownloader.rb +71 -0
- data/lib/cocoapods-aqara-localzedLoader/StringElement.rb +17 -0
- data/lib/cocoapods-aqara-localzedLoader/command/localzedLoader.rb +52 -0
- data/lib/cocoapods-aqara-localzedLoader/command.rb +1 -0
- data/lib/cocoapods-aqara-localzedLoader/excel_generate.rb +5 -0
- data/lib/cocoapods-aqara-localzedLoader/gem_version.rb +3 -0
- data/lib/cocoapods-aqara-localzedLoader/ios_bundle_generate.rb +172 -0
- data/lib/cocoapods-aqara-localzedLoader.rb +1 -0
- data/lib/cocoapods_plugin.rb +8 -0
- data/spec/command/localzedLoader_spec.rb +12 -0
- data/spec/spec_helper.rb +50 -0
- metadata +212 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 49a023fe14fbf9ca4cfa935a7a5e47f6e9fcba70956b441010273085ae541f58
|
|
4
|
+
data.tar.gz: 98b59f8ba74e277b935e7e51894e9951cb1c29c7c0eaa0c6d4f4c1a687eb408c
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 99fb78c88a40cc9fa801044b2a1b21843bd84a37e9e1fe52bb0cda97d2f1c819299d1f1f3003c98efeb4c233dbfe6a0a14367328e76802f8344246f6296b279d
|
|
7
|
+
data.tar.gz: 469233d4e8861342c3b8fe5919d440316a1524fa5ba8728032efe8c29a01f0befb12b5a0672875cef7a026b8ee316a081bfd17f5705b44ce4ce846285b847a70
|
data/.gitignore
ADDED
data/Gemfile
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# Specify your gem's dependencies in cocoapods-aqara-localzedLoader.gemspec
|
|
4
|
+
gemspec
|
|
5
|
+
|
|
6
|
+
group :development do
|
|
7
|
+
gem 'cocoapods'
|
|
8
|
+
|
|
9
|
+
gem 'mocha'
|
|
10
|
+
gem 'bacon'
|
|
11
|
+
gem 'mocha-on-bacon'
|
|
12
|
+
gem 'prettybacon'
|
|
13
|
+
gem 'colored2'
|
|
14
|
+
gem 'fileutils'
|
|
15
|
+
gem 'rubyzip'
|
|
16
|
+
gem 'httparty'
|
|
17
|
+
gem 'rubyXL'
|
|
18
|
+
end
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
cocoapods-aqara-localzedLoader (0.0.1)
|
|
5
|
+
claide (>= 1.0.2, < 2.0)
|
|
6
|
+
colored2
|
|
7
|
+
fileutils
|
|
8
|
+
httparty
|
|
9
|
+
rubyXL
|
|
10
|
+
rubyzip
|
|
11
|
+
|
|
12
|
+
GEM
|
|
13
|
+
remote: https://rubygems.org/
|
|
14
|
+
specs:
|
|
15
|
+
CFPropertyList (3.0.5)
|
|
16
|
+
rexml
|
|
17
|
+
activesupport (6.1.7)
|
|
18
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
19
|
+
i18n (>= 1.6, < 2)
|
|
20
|
+
minitest (>= 5.1)
|
|
21
|
+
tzinfo (~> 2.0)
|
|
22
|
+
zeitwerk (~> 2.3)
|
|
23
|
+
addressable (2.8.1)
|
|
24
|
+
public_suffix (>= 2.0.2, < 6.0)
|
|
25
|
+
algoliasearch (1.27.5)
|
|
26
|
+
httpclient (~> 2.8, >= 2.8.3)
|
|
27
|
+
json (>= 1.5.1)
|
|
28
|
+
atomos (0.1.3)
|
|
29
|
+
bacon (1.2.0)
|
|
30
|
+
claide (1.1.0)
|
|
31
|
+
cocoapods (1.15.2)
|
|
32
|
+
addressable (~> 2.8)
|
|
33
|
+
claide (>= 1.0.2, < 2.0)
|
|
34
|
+
cocoapods-core (= 1.15.2)
|
|
35
|
+
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
|
36
|
+
cocoapods-downloader (>= 2.1, < 3.0)
|
|
37
|
+
cocoapods-plugins (>= 1.0.0, < 2.0)
|
|
38
|
+
cocoapods-search (>= 1.0.0, < 2.0)
|
|
39
|
+
cocoapods-trunk (>= 1.6.0, < 2.0)
|
|
40
|
+
cocoapods-try (>= 1.1.0, < 2.0)
|
|
41
|
+
colored2 (~> 3.1)
|
|
42
|
+
escape (~> 0.0.4)
|
|
43
|
+
fourflusher (>= 2.3.0, < 3.0)
|
|
44
|
+
gh_inspector (~> 1.0)
|
|
45
|
+
molinillo (~> 0.8.0)
|
|
46
|
+
nap (~> 1.0)
|
|
47
|
+
ruby-macho (>= 2.3.0, < 3.0)
|
|
48
|
+
xcodeproj (>= 1.23.0, < 2.0)
|
|
49
|
+
cocoapods-core (1.15.2)
|
|
50
|
+
activesupport (>= 5.0, < 8)
|
|
51
|
+
addressable (~> 2.8)
|
|
52
|
+
algoliasearch (~> 1.0)
|
|
53
|
+
concurrent-ruby (~> 1.1)
|
|
54
|
+
fuzzy_match (~> 2.0.4)
|
|
55
|
+
nap (~> 1.0)
|
|
56
|
+
netrc (~> 0.11)
|
|
57
|
+
public_suffix (~> 4.0)
|
|
58
|
+
typhoeus (~> 1.0)
|
|
59
|
+
cocoapods-deintegrate (1.0.5)
|
|
60
|
+
cocoapods-downloader (2.1)
|
|
61
|
+
cocoapods-plugins (1.0.0)
|
|
62
|
+
nap
|
|
63
|
+
cocoapods-search (1.0.1)
|
|
64
|
+
cocoapods-trunk (1.6.0)
|
|
65
|
+
nap (>= 0.8, < 2.0)
|
|
66
|
+
netrc (~> 0.11)
|
|
67
|
+
cocoapods-try (1.2.0)
|
|
68
|
+
colored2 (3.1.2)
|
|
69
|
+
concurrent-ruby (1.3.3)
|
|
70
|
+
coveralls (0.8.23)
|
|
71
|
+
json (>= 1.8, < 3)
|
|
72
|
+
simplecov (~> 0.16.1)
|
|
73
|
+
term-ansicolor (~> 1.3)
|
|
74
|
+
thor (>= 0.19.4, < 2.0)
|
|
75
|
+
tins (~> 1.6)
|
|
76
|
+
csv (3.3.0)
|
|
77
|
+
diff-lcs (1.5.0)
|
|
78
|
+
docile (1.4.0)
|
|
79
|
+
escape (0.0.4)
|
|
80
|
+
ethon (0.16.0)
|
|
81
|
+
ffi (>= 1.15.0)
|
|
82
|
+
ffi (1.15.5)
|
|
83
|
+
fileutils (1.7.2)
|
|
84
|
+
fourflusher (2.3.1)
|
|
85
|
+
fuzzy_match (2.0.4)
|
|
86
|
+
gh_inspector (1.1.3)
|
|
87
|
+
httparty (0.22.0)
|
|
88
|
+
csv
|
|
89
|
+
mini_mime (>= 1.0.0)
|
|
90
|
+
multi_xml (>= 0.5.2)
|
|
91
|
+
httpclient (2.8.3)
|
|
92
|
+
i18n (1.12.0)
|
|
93
|
+
concurrent-ruby (~> 1.0)
|
|
94
|
+
json (2.6.2)
|
|
95
|
+
mini_mime (1.1.5)
|
|
96
|
+
minitest (5.16.3)
|
|
97
|
+
mocha (2.0.2)
|
|
98
|
+
ruby2_keywords (>= 0.0.5)
|
|
99
|
+
mocha-on-bacon (0.2.3)
|
|
100
|
+
mocha (>= 0.13.0)
|
|
101
|
+
molinillo (0.8.0)
|
|
102
|
+
multi_xml (0.6.0)
|
|
103
|
+
nanaimo (0.3.0)
|
|
104
|
+
nap (1.1.0)
|
|
105
|
+
netrc (0.11.0)
|
|
106
|
+
nokogiri (1.14.0-arm64-darwin)
|
|
107
|
+
racc (~> 1.4)
|
|
108
|
+
prettybacon (0.0.2)
|
|
109
|
+
bacon (~> 1.2)
|
|
110
|
+
public_suffix (4.0.7)
|
|
111
|
+
racc (1.6.2)
|
|
112
|
+
rake (13.0.6)
|
|
113
|
+
rexml (3.2.5)
|
|
114
|
+
rspec (3.12.0)
|
|
115
|
+
rspec-core (~> 3.12.0)
|
|
116
|
+
rspec-expectations (~> 3.12.0)
|
|
117
|
+
rspec-mocks (~> 3.12.0)
|
|
118
|
+
rspec-core (3.12.0)
|
|
119
|
+
rspec-support (~> 3.12.0)
|
|
120
|
+
rspec-expectations (3.12.0)
|
|
121
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
122
|
+
rspec-support (~> 3.12.0)
|
|
123
|
+
rspec-mocks (3.12.0)
|
|
124
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
125
|
+
rspec-support (~> 3.12.0)
|
|
126
|
+
rspec-support (3.12.0)
|
|
127
|
+
ruby-macho (2.5.1)
|
|
128
|
+
ruby2_keywords (0.0.5)
|
|
129
|
+
rubyXL (3.4.12)
|
|
130
|
+
nokogiri (>= 1.4.4)
|
|
131
|
+
rubyzip (>= 1.3.0)
|
|
132
|
+
rubyzip (2.3.2)
|
|
133
|
+
simplecov (0.16.1)
|
|
134
|
+
docile (~> 1.1)
|
|
135
|
+
json (>= 1.8, < 3)
|
|
136
|
+
simplecov-html (~> 0.10.0)
|
|
137
|
+
simplecov-html (0.10.2)
|
|
138
|
+
sync (0.5.0)
|
|
139
|
+
term-ansicolor (1.7.1)
|
|
140
|
+
tins (~> 1.0)
|
|
141
|
+
thor (1.2.1)
|
|
142
|
+
tins (1.31.1)
|
|
143
|
+
sync
|
|
144
|
+
typhoeus (1.4.0)
|
|
145
|
+
ethon (>= 0.9.0)
|
|
146
|
+
tzinfo (2.0.5)
|
|
147
|
+
concurrent-ruby (~> 1.0)
|
|
148
|
+
xcodeproj (1.24.0)
|
|
149
|
+
CFPropertyList (>= 2.3.3, < 4.0)
|
|
150
|
+
atomos (~> 0.1.3)
|
|
151
|
+
claide (>= 1.0.2, < 2.0)
|
|
152
|
+
colored2 (~> 3.1)
|
|
153
|
+
nanaimo (~> 0.3.0)
|
|
154
|
+
rexml (~> 3.2.4)
|
|
155
|
+
zeitwerk (2.6.6)
|
|
156
|
+
|
|
157
|
+
PLATFORMS
|
|
158
|
+
arm64-darwin-21
|
|
159
|
+
|
|
160
|
+
DEPENDENCIES
|
|
161
|
+
bacon
|
|
162
|
+
bundler (>= 2.1)
|
|
163
|
+
cocoapods
|
|
164
|
+
cocoapods-aqara-localzedLoader!
|
|
165
|
+
colored2
|
|
166
|
+
coveralls
|
|
167
|
+
fileutils
|
|
168
|
+
httparty
|
|
169
|
+
mocha
|
|
170
|
+
mocha-on-bacon
|
|
171
|
+
prettybacon
|
|
172
|
+
rake (>= 10.0)
|
|
173
|
+
rspec (>= 3.0)
|
|
174
|
+
rubyXL
|
|
175
|
+
rubyzip
|
|
176
|
+
|
|
177
|
+
BUNDLED WITH
|
|
178
|
+
2.3.26
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 LuckZXF
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2024 zhaoxifan <179988305@qq.com>
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# cocoapods-aqara-localzedLoader
|
data/Rakefile
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'cocoapods-aqara-localzedLoader/gem_version.rb'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = 'cocoapods-aqara-localzedLoader'
|
|
8
|
+
spec.version = Localzedloader::VERSION
|
|
9
|
+
spec.authors = ['zhaoxifan']
|
|
10
|
+
spec.email = ['179988305@qq.com']
|
|
11
|
+
spec.description = %q{Aqara 多语言插件}
|
|
12
|
+
spec.summary = %q{Aqara 多语言从云端多语言平台下载并处理解析成Xcode需要的多语言文件}
|
|
13
|
+
spec.homepage = 'https://github.com/LuckZXF/cocoapods-aqara-localzedLoader'
|
|
14
|
+
spec.license = 'MIT'
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files`.split($/)
|
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
spec.require_paths = ['lib']
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency 'bundler', '>= 2.1'
|
|
22
|
+
spec.add_development_dependency 'coveralls', '>= 0'
|
|
23
|
+
spec.add_development_dependency 'rake', '>= 10.0'
|
|
24
|
+
spec.add_development_dependency 'rspec', '>= 3.0'
|
|
25
|
+
|
|
26
|
+
spec.add_runtime_dependency 'claide', '>= 1.0.2', '< 2.0'
|
|
27
|
+
spec.add_runtime_dependency 'colored2'
|
|
28
|
+
spec.add_runtime_dependency 'fileutils'
|
|
29
|
+
spec.add_runtime_dependency 'rubyzip'
|
|
30
|
+
spec.add_runtime_dependency 'httparty'
|
|
31
|
+
spec.add_runtime_dependency 'rubyXL'
|
|
32
|
+
end
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import shutil
|
|
2
|
+
import os, sys, stat
|
|
3
|
+
import requests
|
|
4
|
+
# import zipfile
|
|
5
|
+
|
|
6
|
+
# from __future__ import print_function
|
|
7
|
+
|
|
8
|
+
from volcengine.iam.IamService import IamService
|
|
9
|
+
|
|
10
|
+
from volcengine.ApiInfo import ApiInfo
|
|
11
|
+
from volcengine.Credentials import Credentials
|
|
12
|
+
from volcengine.base.Service import Service
|
|
13
|
+
from volcengine.ServiceInfo import ServiceInfo
|
|
14
|
+
|
|
15
|
+
from volcengine.auth.SignerV4 import SignerV4
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# 浏览器登录后抓取的 cookie
|
|
19
|
+
myheader = '''
|
|
20
|
+
accept: application/json, text/plain, */*
|
|
21
|
+
accept-encoding: gzip, deflate, br
|
|
22
|
+
accept-language: zh
|
|
23
|
+
content-length: 155
|
|
24
|
+
content-type: application/json
|
|
25
|
+
cookie:experimentation_subject_id=IjZmOTJkNTAwLWRhNGQtNDllOS04NWJmLTViMDA3YWQyNzNmNSI%3D--ea0d856d9ab513dbab485429b3eb34d28baf575c; _ga_WF6G97Z3ZH=GS1.1.1655109583.7.0.1655109635.0; Hm_lvt_2df419cadb3951597d5f6df3a9e563d1=1677809958; __gads=ID=7b3f01c117b67f05-227ecfaf8fe20014:T=1688561915:RT=1695382086:S=ALNI_MZWfx6X7kl8bcHGz9c7kVOi5EJ97g; __gpi=UID=00000c96aea158eb:T=1688561915:RT=1695382086:S=ALNI_MaQoB1d1fZVX_-TNOZ9-FBy0AmJeQ; _ga_3EMB6JL0XV=GS1.1.1695897491.159.0.1695897491.60.0.0; _ga=GA1.1.726824286.1621481586; _ga_1MSMD2CRQ5=GS1.1.1695897492.25.0.1695897492.0.0.0; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%222698037175171e6d.824697002942386177%22%2C%22first_id%22%3A%2217954f52ff723e-046b05611aed99-113a6054-1296000-17954f52ff9e4c%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E5%BC%95%E8%8D%90%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC%22%2C%22%24latest_referrer%22%3A%22https%3A%2F%2Fuc.aqara.cn%2F%22%7D%2C%22%24device_id%22%3A%2217954f52ff723e-046b05611aed99-113a6054-1296000-17954f52ff9e4c%22%7D; Token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI4MzcyOTA5NzQ3NmUwMmYyLjY0MjA2ODExMTgyMzk1MzkyMSIsImlzcyI6Imh0dHBzOi8vYWlvdC1ycGMuYXFhcmEuY24iLCJhY2NvdW50Ijoid2FuaHVhLnlhbkBhcWFyYS5jb20iLCJpYXRHbXQ4IjoxNjk2NjQ2MDYyLCJqdGkiOiI4ZjJlNDJiNTk1MTE0ODFmOTBiMDI3NWExZmE2OWNkZDlkMjVhZDY5NGUzMDQ4MGZhNDM3ZDM2NGI5YTFjZTIzIn0.FqpQfHNi--7FxAu4ytiGpQBwUdMVGDgdKaqZI4hLAus; Userid=83729097476e02f2.642068111823953921; currentSid=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI4MzcyOTA5NzQ3NmUwMmYyLjY0MjA2ODExMTgyMzk1MzkyMSIsImlzcyI6Imh0dHBzOi8vYWlvdC1ycGMuYXFhcmEuY24iLCJpYXRHbXQ4IjoxNjk2NjQ2MDYyLCJqdGkiOiJhNDZlZjExOGE3YTk0ZTIwYTBkNmE5YTE5YjRiM2UxYjM0ZmMxNjYzZTUzYjQ1NzI4Zjk5YzhiYzRhZGUzMGE4In0.W_fWYx-B0kvj2uAUz0pw8vOhw5VKJ4SM5oCwpY_YZkk; currentAccount=wanhua.yan@aqara.com; userInfo=%7B%22accountCategory%22%3A%220%22%2C%22company%22%3A%7B%22companyId%22%3A1%2C%22companyName%22%3A%22%E7%BB%BF%E7%B1%B3%E8%81%94%E5%88%9B%22%7D%2C%22user%22%3A%7B%22avatarUrl%22%3A%22%22%2C%22companyId%22%3A1%2C%22email%22%3A%22wanhua.yan%40aqara.com%22%2C%22nickName%22%3A%22%22%2C%22userType%22%3A0%7D%7D; sidebarStatus=0
|
|
26
|
+
lang: zh
|
|
27
|
+
nonce: z7isblgw7hzfrlebmu7fzoukr20vpvs8
|
|
28
|
+
operate-platform: 40
|
|
29
|
+
origin: https://intl-lang.aqara.com
|
|
30
|
+
projectid: 5
|
|
31
|
+
referer: https://intl-lang.aqara.com/
|
|
32
|
+
sec-ch-ua: "Not/A)Brand";v="99", "Google Chrome";v="115", "Chromium";v="115"
|
|
33
|
+
sec-ch-ua-mobile: ?1
|
|
34
|
+
sec-ch-ua-platform: "Android"
|
|
35
|
+
sec-fetch-dest: empty
|
|
36
|
+
sec-fetch-mode: cors
|
|
37
|
+
sec-fetch-site: same-origin
|
|
38
|
+
time: 1690280776221
|
|
39
|
+
timestamp: 1690280776221
|
|
40
|
+
user-agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Mobile Safari/537.36
|
|
41
|
+
'''
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def MakeHeader(headerText):
|
|
46
|
+
s = headerText.strip().split('\n')
|
|
47
|
+
s = {x.split(':', 1)[0].strip() :x.split(':', 1)[1].strip() for x in s}
|
|
48
|
+
return s
|
|
49
|
+
|
|
50
|
+
def DownLatestLocalizableSource(downloadPath):
|
|
51
|
+
iam_service = IamService()
|
|
52
|
+
ak123 = 'AKLTZTFjNzFjYTczMzJjNGQyMjg0NTRkZjQ2ZTA4MTE1Mjc'
|
|
53
|
+
sk = 'TkdRMU9HSTJZemt6Tmpkak5ERXhaVGt5WXpVNU5qSmxPVFkzWWpBM1pqRQ=='
|
|
54
|
+
iam_service.set_ak(ak123)
|
|
55
|
+
iam_service.set_sk(sk)
|
|
56
|
+
|
|
57
|
+
api_info = ApiInfo("GET", "/", {"serviceName": "i18n_openapi", "Action": "ProjectNamespaceTextDownload",
|
|
58
|
+
"Version": "2021-05-21"}, {}, {})
|
|
59
|
+
service_info = ServiceInfo("iam.volcengineapi.com", {'Accept': 'application/json'},
|
|
60
|
+
Credentials(ak123,sk, 'i18n_openapi', 'cn-north-1'),20,20)
|
|
61
|
+
iam_service.service_info = service_info
|
|
62
|
+
|
|
63
|
+
params = {'async': 0, 'projectId': 5788, 'namespaceId': 42835, 'format': 'xlsx'}
|
|
64
|
+
|
|
65
|
+
r = iam_service.prepare_request(api_info, params, 0)
|
|
66
|
+
SignerV4.sign(r, service_info.credentials)
|
|
67
|
+
url = r.build(0)
|
|
68
|
+
# print(r.headers)
|
|
69
|
+
# res = iam_service.projectNamespaceTextDownload(params)
|
|
70
|
+
|
|
71
|
+
resp = iam_service.session.get(url, headers=r.headers,
|
|
72
|
+
timeout=(service_info.connection_timeout,service_info.socket_timeout))
|
|
73
|
+
if resp.status_code == 200:
|
|
74
|
+
print('下载exccel成功')
|
|
75
|
+
with open(downloadPath+"/download.xlsx", "wb") as code:
|
|
76
|
+
# 将 response 保存成本地文件
|
|
77
|
+
code.write(resp.content)
|
|
78
|
+
code.close()
|
|
79
|
+
else:
|
|
80
|
+
raise Exception(resp.text)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
# def Unzip():
|
|
85
|
+
# f = zipfile.ZipFile("./localizable.zip", 'r') # 压缩文件位置
|
|
86
|
+
# for file in f.namelist():
|
|
87
|
+
# f.extract(file, "../") # 解压位置
|
|
88
|
+
# f.close()
|
|
89
|
+
# os.remove('./localizable.zip')
|
|
90
|
+
|
|
91
|
+
def UpdateSource_language():
|
|
92
|
+
DownLatestLocalizableSource()
|
|
93
|
+
return './download.xlsx'
|
|
94
|
+
|
|
95
|
+
# Unzip()
|
|
96
|
+
# os.rename('./download.xlsx', '../hit_all_str.xlsx')
|
|
97
|
+
# shutil.copy('./download.xlsx', '../source_language/hit_all_str.xlsx')
|
|
98
|
+
# os.remove('./download.xlsx')
|
|
99
|
+
|
|
100
|
+
if __name__ == '__main__':
|
|
101
|
+
localizable_path = sys.argv[1]
|
|
102
|
+
DownLatestLocalizableSource(localizable_path)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
|
|
2
|
+
# require 'file'
|
|
3
|
+
$LOAD_PATH << '.'
|
|
4
|
+
# -*- coding: UTF-8 -*-
|
|
5
|
+
require 'rubyXL'
|
|
6
|
+
require_relative './StringElement'
|
|
7
|
+
|
|
8
|
+
class File_util
|
|
9
|
+
|
|
10
|
+
attr_accessor :keys_hash
|
|
11
|
+
#读取excel 返回StringElement数组
|
|
12
|
+
def read_excel(filename)
|
|
13
|
+
unless filename != nil
|
|
14
|
+
puts "读取的excel为空"
|
|
15
|
+
return
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
workbook = RubyXL::Parser.parse filename
|
|
19
|
+
worksheet = workbook[0]
|
|
20
|
+
row1 = worksheet[0]
|
|
21
|
+
@key_hash = getkeyHash(row1)
|
|
22
|
+
lang_hash = {}
|
|
23
|
+
worksheet.each_with_index do |row,rowIndex|
|
|
24
|
+
next unless rowIndex>0
|
|
25
|
+
ele = StringElement.new
|
|
26
|
+
self_key = ''
|
|
27
|
+
# 设置StringElement的值
|
|
28
|
+
row.cells.each_with_index do |cell, i|
|
|
29
|
+
next unless cell.value
|
|
30
|
+
case i
|
|
31
|
+
when 0
|
|
32
|
+
self_key = cell.value
|
|
33
|
+
else
|
|
34
|
+
key = @key_hash[i]
|
|
35
|
+
if key
|
|
36
|
+
ele.langHash[key] = (cell.value || '')
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
lang_hash[self_key] = ele
|
|
42
|
+
end
|
|
43
|
+
lang_hash
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
#根据第一行来获取当前cell的key
|
|
47
|
+
# return {1:selfkey,2:en,3:zh....} 方便excel取
|
|
48
|
+
# Command+Option+L 对齐快捷键
|
|
49
|
+
def getkeyHash(row1,ios:true)
|
|
50
|
+
keys_hash = {}
|
|
51
|
+
key = ''
|
|
52
|
+
row1.cells.each_with_index do |cell, i|
|
|
53
|
+
next unless cell.value && i > 3
|
|
54
|
+
if cell.value === "zh-CN"
|
|
55
|
+
key = 'zh-Hans'
|
|
56
|
+
elsif cell.value == "zh-TW"
|
|
57
|
+
key = 'zh-Hant-TW'
|
|
58
|
+
elsif cell.value == "zh-HK"
|
|
59
|
+
key = 'zh-HK'
|
|
60
|
+
else
|
|
61
|
+
key = cell.value.split("-")[0]
|
|
62
|
+
end
|
|
63
|
+
# result = cell.value.scan(/.*?\[(.*)\]/)
|
|
64
|
+
keys_hash[i] = key
|
|
65
|
+
end
|
|
66
|
+
keys_hash
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def getLangList
|
|
70
|
+
list = @key_hash.values
|
|
71
|
+
list.delete_if{|item| item.downcase === "keys"||item.downcase === "source" || item.downcase === "length limit" || item.downcase === "context"}
|
|
72
|
+
list
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# hash = File_util.read_excel"hit_all.xls"
|
|
77
|
+
# puts hash.keys.size
|
|
78
|
+
# hash.each do |key,value|
|
|
79
|
+
# puts value
|
|
80
|
+
# end
|
|
81
|
+
|
|
82
|
+
# p "key-sname".split("-")[0]
|
|
83
|
+
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'httparty'
|
|
3
|
+
require 'zip'
|
|
4
|
+
require 'fileutils'
|
|
5
|
+
require 'colored2'
|
|
6
|
+
|
|
7
|
+
class LanguageDownloader
|
|
8
|
+
|
|
9
|
+
HeaderString = %Q{User-Agent: volc-sdk-python/v1.0.109
|
|
10
|
+
Accept-Encoding: gzip, deflate
|
|
11
|
+
Accept: application/json
|
|
12
|
+
Host: iam.volcengineapi.com
|
|
13
|
+
X-Date: 20231017T062815Z
|
|
14
|
+
X-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
|
|
15
|
+
Authorization: HMAC-SHA256 Credential=AKLTZTFjNzFjYTczMzJjNGQyMjg0NTRkZjQ2ZTA4MTE1Mjc/20231017/cn-north-1/i18n_openapi/request, SignedHeaders=host;x-content-sha256;x-date, Signature=fb24f4211cf74f4e985cdd72f09156c288bd8e078d9867813327084204587b0a
|
|
16
|
+
Connection: keep-alive
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
def self.makeHeader
|
|
20
|
+
headerArray = HeaderString.split("\n")
|
|
21
|
+
header = {}
|
|
22
|
+
headerArray.each do |str|
|
|
23
|
+
header[str.split(":",2)[0].strip] = str.split(":",2)[1].strip
|
|
24
|
+
end
|
|
25
|
+
header
|
|
26
|
+
end
|
|
27
|
+
def self.download
|
|
28
|
+
|
|
29
|
+
# puts makeHeader
|
|
30
|
+
#下载文件
|
|
31
|
+
|
|
32
|
+
params = {"projectIdList":[5],"langIds":[1,2,3,9,10,11,12,13,14,15,16,17,18],"fileTypeList":["excel"],"auditState":1,"valueState":0,"userId":"","value":"","tagIds":nil,"bizUseTagIds":nil,"pkeys":[]}
|
|
33
|
+
response = HTTParty.post('https://intl-lang.aqara.com/v1.0/lumi/language/file/export', body: JSON.generate(params), headers:LanguageDownloader.makeHeader)
|
|
34
|
+
# puts response.body
|
|
35
|
+
unless response.body["code"] == nil
|
|
36
|
+
3.times do
|
|
37
|
+
puts "资源包下载失败了!!!!! code:#{response.body}".red
|
|
38
|
+
end
|
|
39
|
+
return
|
|
40
|
+
end
|
|
41
|
+
destation_path = "./localize.zip"
|
|
42
|
+
if File.exist? destation_path
|
|
43
|
+
FileUtils.rm_rf destation_path
|
|
44
|
+
end
|
|
45
|
+
File.open(destation_path,"w") do |io|
|
|
46
|
+
io.binmode
|
|
47
|
+
io.write response.body
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# 解压缩文件到指定目录
|
|
51
|
+
f_path = ''
|
|
52
|
+
|
|
53
|
+
Zip::File.open(destation_path) do |zip_file|
|
|
54
|
+
zip_file.each do |f|
|
|
55
|
+
f_path = File.join('./','hit_all.xls')
|
|
56
|
+
File.delete f_path if File.exist? f_path
|
|
57
|
+
# FileUtils.mkdir_p(File.dirname(f_path))
|
|
58
|
+
f.extract(f_path)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
end
|
|
62
|
+
if File.exist? destation_path
|
|
63
|
+
FileUtils.rm_rf destation_path
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
f_path
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
#LanguageDownloader.download
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class StringElement
|
|
4
|
+
attr_accessor :langHash
|
|
5
|
+
attr_accessor :ios_list
|
|
6
|
+
attr_accessor :android_list
|
|
7
|
+
|
|
8
|
+
def initialize
|
|
9
|
+
@langHash = {}
|
|
10
|
+
@ios_list = []
|
|
11
|
+
@android_list = []
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def to_s
|
|
15
|
+
@langHash.to_s
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
require_relative '../ios_bundle_generate'
|
|
2
|
+
module Pod
|
|
3
|
+
class Command
|
|
4
|
+
# This is an example of a cocoapods plugin adding a top-level subcommand
|
|
5
|
+
# to the 'pod' command.
|
|
6
|
+
#
|
|
7
|
+
# You can also create subcommands of existing or new commands. Say you
|
|
8
|
+
# wanted to add a subcommand to `list` to show newly deprecated pods,
|
|
9
|
+
# (e.g. `pod list deprecated`), there are a few things that would need
|
|
10
|
+
# to change.
|
|
11
|
+
#
|
|
12
|
+
# - move this file to `lib/pod/command/list/deprecated.rb` and update
|
|
13
|
+
# the class to exist in the the Pod::Command::List namespace
|
|
14
|
+
# - change this class to extend from `List` instead of `Command`. This
|
|
15
|
+
# tells the plugin system that it is a subcommand of `list`.
|
|
16
|
+
# - edit `lib/cocoapods_plugins.rb` to require this file
|
|
17
|
+
#
|
|
18
|
+
# @todo Create a PR to add your plugin to CocoaPods/cocoapods.org
|
|
19
|
+
# in the `plugins.json` file, once your plugin is released.
|
|
20
|
+
#
|
|
21
|
+
class Download < Command
|
|
22
|
+
self.summary = 'langDownnloader for user'
|
|
23
|
+
|
|
24
|
+
self.description = <<-DESC
|
|
25
|
+
help user downnloade language resource
|
|
26
|
+
DESC
|
|
27
|
+
|
|
28
|
+
self.arguments = []
|
|
29
|
+
|
|
30
|
+
def initialize(argv)
|
|
31
|
+
super
|
|
32
|
+
# puts "初始化:#{argv}"
|
|
33
|
+
project_directory = argv.option('project-directory')
|
|
34
|
+
puts project_directory
|
|
35
|
+
project_directory = Dir.pwd if project_directory.nil?
|
|
36
|
+
puts project_directory
|
|
37
|
+
@project_directory = Pathname.new(project_directory).expand_path
|
|
38
|
+
puts project_directory
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
def self.options
|
|
42
|
+
[
|
|
43
|
+
['--project-directory=/project/dir/', 'The path to the root of the project directory']
|
|
44
|
+
].concat(super)
|
|
45
|
+
end
|
|
46
|
+
def run
|
|
47
|
+
UI.puts "项目路径 #{@project_directory}"
|
|
48
|
+
BundleGenerater.generate(@project_directory)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'cocoapods-aqara-localzedLoader/command/localzedLoader'
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require_relative './LanguageDownloader'
|
|
3
|
+
require_relative './File_util'
|
|
4
|
+
require 'fileutils'
|
|
5
|
+
# require 'colored2'
|
|
6
|
+
class BundleGenerater
|
|
7
|
+
|
|
8
|
+
# INFO_PLIST_ARRAY = [NSAppleMusicUsageDescription","NSLocalNetworkUsageDescription"]
|
|
9
|
+
INFO_PLIST_MAP = {:common_app_name=>["CFBundleDisplayName"],other_perm_camera_permission_description:["NSCameraUsageDescription"],other_perm_location_permission_description:["NSLocationAlwaysAndWhenInUseUsageDescription","NSLocationWhenInUseUsageDescription","NSLocationAlwaysUsageDescription"],other_perm_bluetooth_permission_description:["NSBluetoothPeripheralUsageDescription","NSBluetoothAlwaysUsageDescription"],access_content_permssion_storage:["NSPhotoLibraryUsageDescription"],other_perm_mic_permission_description:["NSMicrophoneUsageDescription"],other_set_permissions_homedata_desc:["NSHomeKitUsageDescription"],other_set_permissions_asr_text:["NSSpeechRecognitionUsageDescription"],device_add_device:["Add_Device_Title"],automation_add:["Add_Automation_Title"],device_create_scene:["Add_Scene_Title"]}
|
|
10
|
+
def self.generate(project_path)
|
|
11
|
+
# 下载excel
|
|
12
|
+
system "cd #{File.dirname(__FILE__)};python3 DownloadNewLanguage.py #{project_path}"
|
|
13
|
+
f_path = "#{project_path}/download.xlsx"
|
|
14
|
+
print(f_path)
|
|
15
|
+
|
|
16
|
+
# 读取excel到内存
|
|
17
|
+
file_til = File_util.new
|
|
18
|
+
hash = file_til.read_excel f_path
|
|
19
|
+
if File.exist? f_path
|
|
20
|
+
FileUtils.rm_rf f_path
|
|
21
|
+
end
|
|
22
|
+
puts "一共有 #{hash.keys.size} 条文案".green
|
|
23
|
+
|
|
24
|
+
# 创建文件夹
|
|
25
|
+
file_til.getLangList.each do |lang|
|
|
26
|
+
# puts lang
|
|
27
|
+
localized_file = "./#{lang}.lproj/Localizable.strings"
|
|
28
|
+
dir = File.dirname localized_file
|
|
29
|
+
FileUtils.rm_rf localized_file
|
|
30
|
+
FileUtils.mkdir_p dir
|
|
31
|
+
new_file = File.new(localized_file, "w")
|
|
32
|
+
new_file.close
|
|
33
|
+
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
#生成资源文件
|
|
37
|
+
hash.each do |key, stringElement|
|
|
38
|
+
num = 0
|
|
39
|
+
stringElement.langHash.each do |lang, value|
|
|
40
|
+
# puts "#{lang}:#{value}"
|
|
41
|
+
next if lang.downcase === "selfkey" or value === nil or value === " " or value === ""
|
|
42
|
+
value = self.handleValue value,stringElement
|
|
43
|
+
value.scan(/%@/) do |match|
|
|
44
|
+
num = match.size if num == 0
|
|
45
|
+
if num != match.size
|
|
46
|
+
puts "key:#{key}中%@ 数量不一致,请检查".red
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
str = %Q|"#{key}" = "#{value}";\n|
|
|
50
|
+
localized_file = "./#{lang}.lproj/Localizable.strings"
|
|
51
|
+
|
|
52
|
+
if File.exist?(localized_file)
|
|
53
|
+
File.open(localized_file, "a") do |io|
|
|
54
|
+
io.write str
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
#如果是infoplist里的key,就写入指定的文件
|
|
59
|
+
if key === nil
|
|
60
|
+
puts "key值为空,#{stringElement.ios_list}"
|
|
61
|
+
elsif key === "NSAppleMusicUsageDescription" || key === "NSLocalNetworkUsageDescription"
|
|
62
|
+
file = "./#{lang}.lproj/InfoPlist.strings"
|
|
63
|
+
File.open(file, "a") do |io|
|
|
64
|
+
io.write str
|
|
65
|
+
end
|
|
66
|
+
elsif INFO_PLIST_MAP.has_key?(key.to_sym)
|
|
67
|
+
# puts "---key:#{key}"
|
|
68
|
+
keys = INFO_PLIST_MAP[key.to_sym]
|
|
69
|
+
keys.each do |info_key|
|
|
70
|
+
file = "./#{lang}.lproj/InfoPlist.strings"
|
|
71
|
+
str = %Q|"#{info_key}" = "#{value}";\n|
|
|
72
|
+
File.open(file, "a") do |io|
|
|
73
|
+
io.write str
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
#验证导出的多语言包格式是否正确
|
|
82
|
+
puts '开始校验多语言包格式'.red
|
|
83
|
+
# puts "\e[31m 开始校验多语言包格式\e[0m"
|
|
84
|
+
file_til.getLangList.each do |lang|
|
|
85
|
+
localized_file = "./#{lang}.lproj/Localizable.strings"
|
|
86
|
+
file = "./#{lang}.lproj/InfoPlist.strings"
|
|
87
|
+
if File.exist?(file)
|
|
88
|
+
system("plutil #{file}")
|
|
89
|
+
end
|
|
90
|
+
if File.exist?(localized_file)
|
|
91
|
+
system("plutil #{localized_file}")
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
#拷贝到代码仓库里
|
|
96
|
+
#查找bundle路径
|
|
97
|
+
bundPath = ""
|
|
98
|
+
info_plist_path = "./AqaraHome/Resource"
|
|
99
|
+
require 'find'
|
|
100
|
+
Find.find("./") do |filePath|
|
|
101
|
+
if filePath.end_with?("LMFramework.bundle")
|
|
102
|
+
bundPath = filePath
|
|
103
|
+
elsif filePath.end_with?("Resource")
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
unless bundPath != ""
|
|
107
|
+
puts '没有拷贝'
|
|
108
|
+
return
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
copy_info_plist = false
|
|
112
|
+
file_til.getLangList.each do |lang|
|
|
113
|
+
path = "./#{lang}.lproj/Localizable.strings"
|
|
114
|
+
dest = bundPath + "/#{lang}.lproj"
|
|
115
|
+
dest2 = "./AqaraHome/Resource/#{lang}.lproj"
|
|
116
|
+
FileUtils.mkdir_p dest
|
|
117
|
+
FileUtils.cp(path,dest2)
|
|
118
|
+
FileUtils.mv("#{path}",dest,force:true)
|
|
119
|
+
|
|
120
|
+
info_plist_file = "./#{lang}.lproj/InfoPlist.strings"
|
|
121
|
+
# puts "path::::::#{info_plist_file}"
|
|
122
|
+
if File.exist? info_plist_file
|
|
123
|
+
copy_info_plist = true
|
|
124
|
+
dest = "./AqaraHome/Resource/#{lang}.lproj"
|
|
125
|
+
FileUtils.mkdir_p dest
|
|
126
|
+
FileUtils.mv("#{info_plist_file}",dest,force:true)
|
|
127
|
+
end
|
|
128
|
+
FileUtils.rm_rf (File.dirname(path))
|
|
129
|
+
end
|
|
130
|
+
puts "多语言拷贝到目录:#{bundPath}"
|
|
131
|
+
if copy_info_plist
|
|
132
|
+
puts "InfoPlist多语言拷贝到目录:#{info_plist_path}"
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
end
|
|
136
|
+
#对多语言的value进行处理
|
|
137
|
+
def self.handleValue(value='',stringElement = nil)
|
|
138
|
+
#替换{=}
|
|
139
|
+
value = value.gsub(/{#}/,"%@")
|
|
140
|
+
value = value.gsub(/""/,'"')
|
|
141
|
+
value = value.gsub(/\\"/,'"')
|
|
142
|
+
value = value.gsub(/""/,'"')
|
|
143
|
+
value = value.gsub(/"/,'\"')
|
|
144
|
+
#fix "common_time_day_with_space" = "\ day \";
|
|
145
|
+
if value.end_with?"\\"
|
|
146
|
+
value = value.chop
|
|
147
|
+
end
|
|
148
|
+
if value.end_with?"\\"
|
|
149
|
+
value = value.chop
|
|
150
|
+
end
|
|
151
|
+
value
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
# BundleGenerater.generate
|
|
158
|
+
# map = {:common_app_name=>["CFBundleDisplayName"]}
|
|
159
|
+
# if map.has_key?("common_app_name".to_sym)
|
|
160
|
+
# puts map[:common_app_name]
|
|
161
|
+
# end
|
|
162
|
+
# BundleGenerater.generate
|
|
163
|
+
# ios_list = ["%@","%d"]
|
|
164
|
+
# str = "{#}盏灯开着,真的吗{#}"
|
|
165
|
+
# i = -1
|
|
166
|
+
# str = str.gsub(/{#}/) do |matched|
|
|
167
|
+
# i+=1
|
|
168
|
+
# ios_list[i]
|
|
169
|
+
# end
|
|
170
|
+
#
|
|
171
|
+
# p str
|
|
172
|
+
# puts "111".green
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'cocoapods-aqara-localzedLoader/gem_version'
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
require 'cocoapods-aqara-localzedLoader/command'
|
|
2
|
+
require_relative 'cocoapods-aqara-localzedLoader/ios_bundle_generate'
|
|
3
|
+
module Pod
|
|
4
|
+
Pod::HooksManager.register('cocoapods-aqara-localzedLoader', :pre_install) do |context|
|
|
5
|
+
args = ['download', "--project-directory=#{Config.instance.installation_root}"]
|
|
6
|
+
Pod::Command.run(args)
|
|
7
|
+
end
|
|
8
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
|
2
|
+
|
|
3
|
+
module Pod
|
|
4
|
+
describe Command::Localzedloader do
|
|
5
|
+
describe 'CLAide' do
|
|
6
|
+
it 'registers it self' do
|
|
7
|
+
Command.parse(%w{ localzedLoader }).should.be.instance_of Command::Localzedloader
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require 'pathname'
|
|
2
|
+
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
|
|
3
|
+
$:.unshift((ROOT + 'lib').to_s)
|
|
4
|
+
$:.unshift((ROOT + 'spec').to_s)
|
|
5
|
+
|
|
6
|
+
require 'bundler/setup'
|
|
7
|
+
require 'bacon'
|
|
8
|
+
require 'mocha-on-bacon'
|
|
9
|
+
require 'pretty_bacon'
|
|
10
|
+
require 'pathname'
|
|
11
|
+
require 'cocoapods'
|
|
12
|
+
|
|
13
|
+
Mocha::Configuration.prevent(:stubbing_non_existent_method)
|
|
14
|
+
|
|
15
|
+
require 'cocoapods_plugin'
|
|
16
|
+
|
|
17
|
+
#-----------------------------------------------------------------------------#
|
|
18
|
+
|
|
19
|
+
module Pod
|
|
20
|
+
|
|
21
|
+
# Disable the wrapping so the output is deterministic in the tests.
|
|
22
|
+
#
|
|
23
|
+
UI.disable_wrap = true
|
|
24
|
+
|
|
25
|
+
# Redirects the messages to an internal store.
|
|
26
|
+
#
|
|
27
|
+
module UI
|
|
28
|
+
@output = ''
|
|
29
|
+
@warnings = ''
|
|
30
|
+
|
|
31
|
+
class << self
|
|
32
|
+
attr_accessor :output
|
|
33
|
+
attr_accessor :warnings
|
|
34
|
+
|
|
35
|
+
def puts(message = '')
|
|
36
|
+
@output << "#{message}\n"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def warn(message = '', actions = [])
|
|
40
|
+
@warnings << "#{message}\n"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def print(message)
|
|
44
|
+
@output << message
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
#-----------------------------------------------------------------------------#
|
metadata
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: cocoapods-aqara-localzedLoader
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- zhaoxifan
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2024-08-05 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '2.1'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '2.1'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: coveralls
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rake
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '10.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '10.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rspec
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '3.0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '3.0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: claide
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: 1.0.2
|
|
76
|
+
- - "<"
|
|
77
|
+
- !ruby/object:Gem::Version
|
|
78
|
+
version: '2.0'
|
|
79
|
+
type: :runtime
|
|
80
|
+
prerelease: false
|
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
82
|
+
requirements:
|
|
83
|
+
- - ">="
|
|
84
|
+
- !ruby/object:Gem::Version
|
|
85
|
+
version: 1.0.2
|
|
86
|
+
- - "<"
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '2.0'
|
|
89
|
+
- !ruby/object:Gem::Dependency
|
|
90
|
+
name: colored2
|
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - ">="
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '0'
|
|
96
|
+
type: :runtime
|
|
97
|
+
prerelease: false
|
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '0'
|
|
103
|
+
- !ruby/object:Gem::Dependency
|
|
104
|
+
name: fileutils
|
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - ">="
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: '0'
|
|
110
|
+
type: :runtime
|
|
111
|
+
prerelease: false
|
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - ">="
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '0'
|
|
117
|
+
- !ruby/object:Gem::Dependency
|
|
118
|
+
name: rubyzip
|
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - ">="
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: '0'
|
|
124
|
+
type: :runtime
|
|
125
|
+
prerelease: false
|
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
127
|
+
requirements:
|
|
128
|
+
- - ">="
|
|
129
|
+
- !ruby/object:Gem::Version
|
|
130
|
+
version: '0'
|
|
131
|
+
- !ruby/object:Gem::Dependency
|
|
132
|
+
name: httparty
|
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
|
134
|
+
requirements:
|
|
135
|
+
- - ">="
|
|
136
|
+
- !ruby/object:Gem::Version
|
|
137
|
+
version: '0'
|
|
138
|
+
type: :runtime
|
|
139
|
+
prerelease: false
|
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
141
|
+
requirements:
|
|
142
|
+
- - ">="
|
|
143
|
+
- !ruby/object:Gem::Version
|
|
144
|
+
version: '0'
|
|
145
|
+
- !ruby/object:Gem::Dependency
|
|
146
|
+
name: rubyXL
|
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
|
148
|
+
requirements:
|
|
149
|
+
- - ">="
|
|
150
|
+
- !ruby/object:Gem::Version
|
|
151
|
+
version: '0'
|
|
152
|
+
type: :runtime
|
|
153
|
+
prerelease: false
|
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
155
|
+
requirements:
|
|
156
|
+
- - ">="
|
|
157
|
+
- !ruby/object:Gem::Version
|
|
158
|
+
version: '0'
|
|
159
|
+
description: Aqara 多语言插件
|
|
160
|
+
email:
|
|
161
|
+
- 179988305@qq.com
|
|
162
|
+
executables: []
|
|
163
|
+
extensions: []
|
|
164
|
+
extra_rdoc_files: []
|
|
165
|
+
files:
|
|
166
|
+
- ".gitignore"
|
|
167
|
+
- Gemfile
|
|
168
|
+
- Gemfile.lock
|
|
169
|
+
- LICENSE
|
|
170
|
+
- LICENSE.txt
|
|
171
|
+
- README.md
|
|
172
|
+
- Rakefile
|
|
173
|
+
- cocoapods-aqara-localzedLoader.gemspec
|
|
174
|
+
- lib/cocoapods-aqara-localzedLoader.rb
|
|
175
|
+
- lib/cocoapods-aqara-localzedLoader/DownloadNewLanguage.py
|
|
176
|
+
- lib/cocoapods-aqara-localzedLoader/File_util.rb
|
|
177
|
+
- lib/cocoapods-aqara-localzedLoader/LanguageDownloader.rb
|
|
178
|
+
- lib/cocoapods-aqara-localzedLoader/StringElement.rb
|
|
179
|
+
- lib/cocoapods-aqara-localzedLoader/command.rb
|
|
180
|
+
- lib/cocoapods-aqara-localzedLoader/command/localzedLoader.rb
|
|
181
|
+
- lib/cocoapods-aqara-localzedLoader/excel_generate.rb
|
|
182
|
+
- lib/cocoapods-aqara-localzedLoader/gem_version.rb
|
|
183
|
+
- lib/cocoapods-aqara-localzedLoader/ios_bundle_generate.rb
|
|
184
|
+
- lib/cocoapods_plugin.rb
|
|
185
|
+
- spec/command/localzedLoader_spec.rb
|
|
186
|
+
- spec/spec_helper.rb
|
|
187
|
+
homepage: https://github.com/LuckZXF/cocoapods-aqara-localzedLoader
|
|
188
|
+
licenses:
|
|
189
|
+
- MIT
|
|
190
|
+
metadata: {}
|
|
191
|
+
post_install_message:
|
|
192
|
+
rdoc_options: []
|
|
193
|
+
require_paths:
|
|
194
|
+
- lib
|
|
195
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
196
|
+
requirements:
|
|
197
|
+
- - ">="
|
|
198
|
+
- !ruby/object:Gem::Version
|
|
199
|
+
version: '0'
|
|
200
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
|
+
requirements:
|
|
202
|
+
- - ">="
|
|
203
|
+
- !ruby/object:Gem::Version
|
|
204
|
+
version: '0'
|
|
205
|
+
requirements: []
|
|
206
|
+
rubygems_version: 3.3.26
|
|
207
|
+
signing_key:
|
|
208
|
+
specification_version: 4
|
|
209
|
+
summary: Aqara 多语言从云端多语言平台下载并处理解析成Xcode需要的多语言文件
|
|
210
|
+
test_files:
|
|
211
|
+
- spec/command/localzedLoader_spec.rb
|
|
212
|
+
- spec/spec_helper.rb
|