pixab 1.2.7 → 1.3.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 +4 -4
- data/lib/Localization.rb +7 -1
- data/lib/LocalizationPlatform.rb +20 -2
- data/lib/Utilities.rb +13 -1
- data/lib/pixab/version.rb +1 -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: c8a6813998f3505f0d331e04c263dbd774d930dfccb8427cbdb5e2d63cd0f95c
|
4
|
+
data.tar.gz: 9cd068595fc87fae2848a60edffec01b643d19a979e68a04af41394178f5cbff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 867831964a673527b7ad61b1630ed26b1c8f0de6f83b63215925b40b8a192f9fee62b956e7dcd6742858e1d44fedd97653b0ac9ee1848c95a9bf017e1e207141
|
7
|
+
data.tar.gz: 54176108087fee9abd768f5f8c3bceca020947e4fa32d0d71313996a317176d4f5e2f171162f3d7cd4b36c86e5397b6d14a51bca52acd670d084336c3c9e8e12
|
data/lib/Localization.rb
CHANGED
@@ -12,6 +12,7 @@ module Pixab
|
|
12
12
|
ACCESS_TOKEN = 'bdbda2cc022951235808a4f6c7a7330d4de7dcf719650d7d2ceee260e07d3f01'
|
13
13
|
Project_AirBrush = '546ed49bfca9d3a4f51ccf2c8c279d0f'
|
14
14
|
Project_AirBrush_Video = 'fcb3e858aa1d991e8c21222f3696ce67'
|
15
|
+
Project_AirBrush_Studio = '16a0814854c608d496e8a410f567666b'
|
15
16
|
|
16
17
|
attr_accessor :projects, :tags, :platform, :mode
|
17
18
|
|
@@ -39,6 +40,10 @@ module Pixab
|
|
39
40
|
@projects = "#{Project_AirBrush_Video}"
|
40
41
|
@mode = 'add'
|
41
42
|
@tags = 'iOS'
|
43
|
+
when '--ab-Mac'
|
44
|
+
@projects = "#{Project_AirBrush_Studio}"
|
45
|
+
@platform = 'Mac'
|
46
|
+
@mode = 'add'
|
42
47
|
end
|
43
48
|
end
|
44
49
|
|
@@ -77,7 +82,6 @@ module Pixab
|
|
77
82
|
while true
|
78
83
|
link = "\"https://api.phrase.com/v2/projects/#{project}/translations?page=#{page_number}&per_page=100&sort=created_at"
|
79
84
|
if !tags.nil?
|
80
|
-
# excluded:false
|
81
85
|
link += "&q=tags:#{tags}%20excluded:false"
|
82
86
|
end
|
83
87
|
link += "\""
|
@@ -124,6 +128,8 @@ module Pixab
|
|
124
128
|
end
|
125
129
|
if platform == 'android'
|
126
130
|
LocalizationAndroid.new.run(localized_info_category, platform_commands)
|
131
|
+
elsif platform == 'Mac'
|
132
|
+
LocalizationMac.new.run(localized_info_category, platform_commands)
|
127
133
|
else
|
128
134
|
LocalizationiOS.new.run(localized_info_category, platform_commands)
|
129
135
|
end
|
data/lib/LocalizationPlatform.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
# encoding: UTF-8
|
3
3
|
|
4
4
|
require "fileutils"
|
5
|
+
require_relative './Utilities.rb'
|
5
6
|
|
6
7
|
module Pixab
|
7
8
|
|
@@ -54,7 +55,7 @@ module Pixab
|
|
54
55
|
|
55
56
|
localized_info_category.each do |locale, localized_infos|
|
56
57
|
content_dir_path = dir_name(locale)
|
57
|
-
if !
|
58
|
+
if !Utilities.dir_exist(content_dir_path)
|
58
59
|
FileUtils.mkdir_p content_dir_path
|
59
60
|
end
|
60
61
|
content_file_path = "#{content_dir_path}/#{File_name}"
|
@@ -87,6 +88,23 @@ module Pixab
|
|
87
88
|
|
88
89
|
end
|
89
90
|
|
91
|
+
module Pixab
|
92
|
+
|
93
|
+
class LocalizationMac < LocalizationiOS
|
94
|
+
|
95
|
+
def dir_name(locale)
|
96
|
+
suffix = locale
|
97
|
+
case locale
|
98
|
+
when 'pt'
|
99
|
+
suffix = 'pt-PT'
|
100
|
+
end
|
101
|
+
return "#{suffix}.lproj"
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
|
90
108
|
module Pixab
|
91
109
|
|
92
110
|
class LocalizationAndroid < LocalizationPlatform
|
@@ -101,7 +119,7 @@ module Pixab
|
|
101
119
|
end
|
102
120
|
|
103
121
|
content_dir_path = dir_name(locale)
|
104
|
-
if !
|
122
|
+
if !Utilities.dir_exist(content_dir_path)
|
105
123
|
FileUtils.mkdir_p content_dir_path
|
106
124
|
end
|
107
125
|
content_file_path = "#{content_dir_path}/#{File_name}"
|
data/lib/Utilities.rb
CHANGED
@@ -11,7 +11,6 @@ module Pixab
|
|
11
11
|
|
12
12
|
class << Utilities
|
13
13
|
|
14
|
-
|
15
14
|
def is_shell_execute_success(success = nil)
|
16
15
|
is_success = success.nil? ? $?.to_i == 0 : success
|
17
16
|
return is_success
|
@@ -80,5 +79,18 @@ module Pixab
|
|
80
79
|
end
|
81
80
|
|
82
81
|
end
|
82
|
+
|
83
|
+
class << Utilities
|
84
|
+
|
85
|
+
# 判断目录是否存在,已适配2.4以后的版本
|
86
|
+
def dir_exist(path)
|
87
|
+
if Dir.respond_to?(:exist?)
|
88
|
+
return Dir.exist?(path)
|
89
|
+
else
|
90
|
+
return Dir.exists?(path)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
83
95
|
|
84
96
|
end
|
data/lib/pixab/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pixab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 廖再润
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colored2
|