pixab 1.0.0 → 1.1.0
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/Localization.rb +35 -7
- data/lib/LocalizationPlatform.rb +9 -5
- data/lib/pixab/version.rb +1 -1
- data/pixab.gemspec +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c08c4161b4d58e4231ff4fda0f44c2e7e30746f1ac4aac389f47977640aea3d
|
4
|
+
data.tar.gz: 75710c9fd4596aaa80df25a8c39136d67adbc2b295c475f081d0899085aa716a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ed8b6d8a3d767e2c34e40bb289c5d46e951ccf027a7542c5a9e12ab464fc1a3e182de961ceb4a5cd13803ede407ddf9b31ac663df831897f2b8632b701ee6c0
|
7
|
+
data.tar.gz: 24108b17da8b4ddc10ed714ca25b0ef442c1a67e8d5c35aa7fd82aec54153fd1bacbb477cc689e5a2bc3f9f80c487675f1bb0963fea2a60e049a01d5b53bfccb
|
data/lib/Localization.rb
CHANGED
@@ -10,6 +10,8 @@ module Pixab
|
|
10
10
|
class Localization
|
11
11
|
|
12
12
|
ACCESS_TOKEN = '4f5379d0d26b9a2ef167b3fc84fb47f1fe2b4e87b1f95d8f5fc15269132051ef'
|
13
|
+
Project_AirBrush = '546ed49bfca9d3a4f51ccf2c8c279d0f'
|
14
|
+
Project_AirBrush_Video = 'fcb3e858aa1d991e8c21222f3696ce67'
|
13
15
|
|
14
16
|
attr_accessor :projects, :tags, :platform, :mode
|
15
17
|
|
@@ -21,14 +23,33 @@ module Pixab
|
|
21
23
|
commands.each_index do |index|
|
22
24
|
command = commands[index]
|
23
25
|
case command
|
24
|
-
when
|
25
|
-
|
26
|
-
when
|
26
|
+
when '--project-ab'
|
27
|
+
add_project(Project_AirBrush)
|
28
|
+
when '--project-abv'
|
29
|
+
add_project(Project_AirBrush_Video)
|
30
|
+
when '--tags'
|
27
31
|
@tags = commands[index + 1]
|
28
|
-
when
|
32
|
+
when '--platform'
|
29
33
|
@platform = commands[index + 1]
|
30
|
-
when
|
34
|
+
when '--mode'
|
31
35
|
@mode = commands[index + 1]
|
36
|
+
when '--ab-android'
|
37
|
+
@projects = "#{Project_AirBrush},#{Project_AirBrush_Video}"
|
38
|
+
@platform = 'android'
|
39
|
+
when '--ab-iOS'
|
40
|
+
@projects = "#{Project_AirBrush}"
|
41
|
+
@mode = 'add'
|
42
|
+
when '--abv-iOS'
|
43
|
+
@projects = "#{Project_AirBrush_Video}"
|
44
|
+
@mode = 'add'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
commands.each_index do |index|
|
49
|
+
command = commands[index]
|
50
|
+
case command
|
51
|
+
when '--projects'
|
52
|
+
@projects = commands[index + 1]
|
32
53
|
end
|
33
54
|
end
|
34
55
|
|
@@ -91,9 +112,16 @@ module Pixab
|
|
91
112
|
end
|
92
113
|
end
|
93
114
|
|
115
|
+
# 添加拉取的project
|
116
|
+
def add_project(project_id)
|
117
|
+
if projects.nil?
|
118
|
+
@projects = "#{project_id}"
|
119
|
+
else
|
120
|
+
@projects += ",#{project_id}"
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
94
124
|
end
|
95
125
|
|
96
126
|
end
|
97
127
|
|
98
|
-
Pixab::Localization.new.run(ARGV)
|
99
|
-
|
data/lib/LocalizationPlatform.rb
CHANGED
@@ -32,8 +32,7 @@ module Pixab
|
|
32
32
|
|
33
33
|
def dir_name(locale)
|
34
34
|
return ''
|
35
|
-
end
|
36
|
-
|
35
|
+
end
|
37
36
|
|
38
37
|
end
|
39
38
|
|
@@ -80,9 +79,14 @@ module Pixab
|
|
80
79
|
class LocalizationAndroid < LocalizationPlatform
|
81
80
|
|
82
81
|
File_name = "strings_ph.xml"
|
82
|
+
Exclude_locales = ['zh-Hant']
|
83
83
|
|
84
84
|
def run(localized_info_category, commands)
|
85
85
|
localized_info_category.each do |locale, localized_infos|
|
86
|
+
if Exclude_locales.include?(locale)
|
87
|
+
next
|
88
|
+
end
|
89
|
+
|
86
90
|
content_dir_path = dir_name(locale)
|
87
91
|
if !Dir.exists?(content_dir_path)
|
88
92
|
FileUtils.mkdir_p content_dir_path
|
@@ -90,7 +94,7 @@ module Pixab
|
|
90
94
|
content_file_path = "#{content_dir_path}/#{File_name}"
|
91
95
|
File.open(content_file_path, @file_mode) do |aFile|
|
92
96
|
aFile.syswrite("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
93
|
-
aFile.syswrite("<resources
|
97
|
+
aFile.syswrite("<resources>\n")
|
94
98
|
localized_infos.each do |localized_info|
|
95
99
|
aFile.syswrite(" <string name=\"#{localized_info['key']}\">#{localized_info['value']}</string>\n")
|
96
100
|
end
|
@@ -109,9 +113,9 @@ module Pixab
|
|
109
113
|
suffix = '-fr-rFR'
|
110
114
|
when 'ru'
|
111
115
|
suffix = '-ru-rRU'
|
112
|
-
when 'zh-
|
116
|
+
when 'zh-Hans'
|
113
117
|
suffix = '-zh-rCN'
|
114
|
-
when '
|
118
|
+
when 'tr'
|
115
119
|
suffix = '-tr-rTR'
|
116
120
|
else
|
117
121
|
suffix = "-#{locale}"
|
data/lib/pixab/version.rb
CHANGED
data/pixab.gemspec
CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.require_paths = ["lib"]
|
34
34
|
|
35
35
|
# Uncomment to register a new dependency of your gem
|
36
|
-
|
36
|
+
spec.add_dependency "colored2"
|
37
37
|
|
38
38
|
# For more information and examples about making a new gem, check out our
|
39
39
|
# guide at: https://bundler.io/guides/creating_gem.html
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pixab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 廖再润
|
@@ -9,7 +9,21 @@ autorequire:
|
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
11
|
date: 2022-12-27 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: colored2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
description: Write a longer description or delete this line.
|
14
28
|
email:
|
15
29
|
- lzr3@us.meitu.com
|