applocale 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/applocale/AppLocaleFile +2 -30
- data/lib/applocale/Command/init.rb +19 -5
- data/lib/applocale/Core/CompareStringFile/compare_string_file.rb +223 -0
- data/lib/applocale/Core/ParseCSV/parse_csv.rb +18 -5
- data/lib/applocale/Core/ParseXLSX/parse_xlsx.rb +13 -7
- data/lib/applocale/Core/ParserStringFile/parse_localized_resource.rb +5 -6
- data/lib/applocale/Core/ParserStringFile/parse_strings_file.rb +6 -16
- data/lib/applocale/Core/ParserStringFile/parse_xml_file.rb +7 -15
- data/lib/applocale/Core/convert_to_localefile.rb +14 -24
- data/lib/applocale/Core/init.rb +48 -11
- data/lib/applocale/Core/setting.rb +5 -1
- data/lib/applocale/Util/config_util.rb +22 -204
- data/lib/applocale/Util/convert_util.rb +71 -0
- data/lib/applocale/Util/error_util.rb +13 -0
- data/lib/applocale/Util/file_util.rb +8 -7
- data/lib/applocale/Util/regex_util.rb +1 -1
- data/lib/applocale/convert.rb +19 -0
- data/lib/applocale/version.rb +1 -1
- metadata +6 -4
- data/lib/applocale/Util/injection.rb +0 -89
@@ -0,0 +1,71 @@
|
|
1
|
+
require File.expand_path('../error_util.rb', __FILE__)
|
2
|
+
|
3
|
+
module Applocale
|
4
|
+
class ConvertFile
|
5
|
+
|
6
|
+
|
7
|
+
attr_accessor :filepath
|
8
|
+
|
9
|
+
@convert
|
10
|
+
@filepath
|
11
|
+
|
12
|
+
|
13
|
+
def initialize(convert_file, dir)
|
14
|
+
unless convert_file.nil?
|
15
|
+
if convert_file.to_s.strip.length > 0
|
16
|
+
convertFilePath = File.expand_path(convert_file, dir)
|
17
|
+
if File.exist?(convertFilePath)
|
18
|
+
require convertFilePath
|
19
|
+
@convert = Convert.new()
|
20
|
+
@filepath = convertFilePath.to_s
|
21
|
+
return
|
22
|
+
else
|
23
|
+
ErrorUtil::ConfigFileInValid.new('convert file not exist ').raise
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
@convert = Object.new()
|
28
|
+
end
|
29
|
+
|
30
|
+
public
|
31
|
+
def has_convent_to_locale
|
32
|
+
return defined?(@convert.convent_to_locale) == 'method'
|
33
|
+
end
|
34
|
+
|
35
|
+
public
|
36
|
+
def load_convent_to_locale(lang, key, before_convert_value, after_convert_value)
|
37
|
+
return @convert.convent_to_locale(lang, key, before_convert_value, after_convert_value)
|
38
|
+
end
|
39
|
+
|
40
|
+
public
|
41
|
+
def has_parse_from_locale
|
42
|
+
return defined?(@convert.parse_from_locale) == 'method'
|
43
|
+
end
|
44
|
+
|
45
|
+
public
|
46
|
+
def load_parse_from_locale(lang, key, before_convert_value, after_convert_value)
|
47
|
+
return @convert.parse_from_locale(lang, key, before_convert_value, after_convert_value)
|
48
|
+
end
|
49
|
+
|
50
|
+
public
|
51
|
+
def has_is_skip_by_key
|
52
|
+
return defined?(@convert.is_skip_by_key) == 'method'
|
53
|
+
end
|
54
|
+
|
55
|
+
public
|
56
|
+
def load_is_skip_by_key(sheetname, key)
|
57
|
+
return @convert.is_skip_by_key(sheetname, key)
|
58
|
+
end
|
59
|
+
|
60
|
+
public
|
61
|
+
def has_parse_from_excel_or_csv
|
62
|
+
return defined?(@convert.parse_from_excel_or_csv) == 'method'
|
63
|
+
end
|
64
|
+
|
65
|
+
public
|
66
|
+
def load_parse_from_excel_or_csv(sheetname, key, before_convert_value, after_convert_value)
|
67
|
+
return @convert.parse_from_excel_or_csv(sheetname, key, before_convert_value, after_convert_value)
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
@@ -50,6 +50,19 @@ module Applocale
|
|
50
50
|
"Can't open xlsx file #{self.path}"
|
51
51
|
end
|
52
52
|
end
|
53
|
+
|
54
|
+
class FileNotExist < CommandError
|
55
|
+
def message
|
56
|
+
"File not exist"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class FileMustSameExt < CommandError
|
61
|
+
def message
|
62
|
+
"Two file format not same"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
53
66
|
end
|
54
67
|
end
|
55
68
|
|
@@ -12,6 +12,7 @@ module Applocale
|
|
12
12
|
FILENAME_XLSX = 'string.xlsx'
|
13
13
|
GOOGLE_CREDENTIALS = 'google_credentials.yaml'
|
14
14
|
EXPORT_FORMAT = 'xlsx'
|
15
|
+
RESOURCE_FOLDER = 'Resource'
|
15
16
|
|
16
17
|
def self.get_proj_absoluat_path(proj_path)
|
17
18
|
path = proj_path
|
@@ -30,7 +31,7 @@ module Applocale
|
|
30
31
|
end
|
31
32
|
|
32
33
|
def self.default_export_to
|
33
|
-
return
|
34
|
+
return RESOURCE_FOLDER
|
34
35
|
end
|
35
36
|
|
36
37
|
def self.default_mainfolder
|
@@ -62,12 +63,12 @@ module Applocale
|
|
62
63
|
EXPORT_FORMAT
|
63
64
|
end
|
64
65
|
|
65
|
-
def self.str_to_folderpathstr(str)
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
66
|
+
# def self.str_to_folderpathstr(str)
|
67
|
+
# pathstr = Pathname.new(str.strip)
|
68
|
+
# if File.directory?(pathstr)
|
69
|
+
# pathstr = File.join(self.configfile_pathstr, FilePathUtil.default_config_filename).to_s
|
70
|
+
# end
|
71
|
+
# end
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Convert
|
2
|
+
|
3
|
+
# def convent_to_locale(lang, key, before_convert_value, after_convert_value)
|
4
|
+
# return new_value
|
5
|
+
# end
|
6
|
+
|
7
|
+
# def parse_from_locale(lang, key, before_convert_value, after_convert_value)
|
8
|
+
# return value
|
9
|
+
# end
|
10
|
+
|
11
|
+
# def is_skip_by_key(sheetname, key)
|
12
|
+
# return true
|
13
|
+
# end
|
14
|
+
|
15
|
+
# def parse_from_excel_or_csv(sheetname, key, before_convert_value, after_convert_value)
|
16
|
+
# return value
|
17
|
+
# end
|
18
|
+
|
19
|
+
end
|
data/lib/applocale/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: applocale
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kennix
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- lib/applocale/AppLocaleFile
|
132
132
|
- lib/applocale/Command/init.rb
|
133
133
|
- lib/applocale/Core/Compare/compare_xlsx_str.rb
|
134
|
+
- lib/applocale/Core/CompareStringFile/compare_string_file.rb
|
134
135
|
- lib/applocale/Core/FindStrKey/find_str_key.rb
|
135
136
|
- lib/applocale/Core/FindStrKey/find_str_key_ios.rb
|
136
137
|
- lib/applocale/Core/FindStrKey/find_str_key_result.rb
|
@@ -147,12 +148,13 @@ files:
|
|
147
148
|
- lib/applocale/Core/init.rb
|
148
149
|
- lib/applocale/Core/setting.rb
|
149
150
|
- lib/applocale/Util/config_util.rb
|
151
|
+
- lib/applocale/Util/convert_util.rb
|
150
152
|
- lib/applocale/Util/error_util.rb
|
151
153
|
- lib/applocale/Util/file_util.rb
|
152
|
-
- lib/applocale/Util/injection.rb
|
153
154
|
- lib/applocale/Util/lang.rb
|
154
155
|
- lib/applocale/Util/platform.rb
|
155
156
|
- lib/applocale/Util/regex_util.rb
|
157
|
+
- lib/applocale/convert.rb
|
156
158
|
- lib/applocale/version.rb
|
157
159
|
homepage: https://github.com/kennixdev/applocale
|
158
160
|
licenses:
|
@@ -174,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
176
|
version: '0'
|
175
177
|
requirements: []
|
176
178
|
rubyforge_project:
|
177
|
-
rubygems_version: 2.
|
179
|
+
rubygems_version: 2.5.2.3
|
178
180
|
signing_key:
|
179
181
|
specification_version: 4
|
180
182
|
summary: for mobile application to manage localization
|
@@ -1,89 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
module Applocale
|
4
|
-
class Injection
|
5
|
-
def self.load(rubycode)
|
6
|
-
obj = Applocale::Injection.new()
|
7
|
-
obj.load(rubycode)
|
8
|
-
return obj
|
9
|
-
end
|
10
|
-
|
11
|
-
def load(rubycode)
|
12
|
-
if !rubycode.nil?
|
13
|
-
eval rubycode
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
public
|
18
|
-
def has_convent_to_locale
|
19
|
-
return defined?(convent_to_locale) == 'method'
|
20
|
-
end
|
21
|
-
|
22
|
-
public
|
23
|
-
def load_convent_to_locale(lang, key, value)
|
24
|
-
return convent_to_locale(lang, key, value)
|
25
|
-
end
|
26
|
-
|
27
|
-
public
|
28
|
-
def has_before_convent_to_locale
|
29
|
-
return defined?(before_convent_to_locale) == 'method'
|
30
|
-
end
|
31
|
-
|
32
|
-
public
|
33
|
-
def load_before_convent_to_locale(lang, key, value)
|
34
|
-
return before_convent_to_locale(lang, key, value)
|
35
|
-
end
|
36
|
-
|
37
|
-
public
|
38
|
-
def has_after_convent_to_locale
|
39
|
-
return defined?(after_convent_to_locale) == 'method'
|
40
|
-
end
|
41
|
-
|
42
|
-
public
|
43
|
-
def load_after_convent_to_locale(lang, key, value)
|
44
|
-
return after_convent_to_locale(lang, key, value)
|
45
|
-
end
|
46
|
-
|
47
|
-
#
|
48
|
-
public
|
49
|
-
def has_parse_from_locale
|
50
|
-
return defined?(parse_from_locale) == 'method'
|
51
|
-
end
|
52
|
-
|
53
|
-
public
|
54
|
-
def load_parse_from_locale(lang, key, value)
|
55
|
-
return parse_from_locale(lang, key, value)
|
56
|
-
end
|
57
|
-
|
58
|
-
public
|
59
|
-
def has_before_parse_from_locale
|
60
|
-
return defined?(before_parse_from_locale) == 'method'
|
61
|
-
end
|
62
|
-
|
63
|
-
public
|
64
|
-
def load_before_parse_from_locale(lang, key, value)
|
65
|
-
return before_parse_from_locale(lang, key, value)
|
66
|
-
end
|
67
|
-
|
68
|
-
public
|
69
|
-
def has_after_parse_from_locale
|
70
|
-
return defined?(after_parse_from_locale) == 'method'
|
71
|
-
end
|
72
|
-
|
73
|
-
public
|
74
|
-
def load_after_parse_from_locale(lang, key, value)
|
75
|
-
return after_parse_from_locale(lang, key, value)
|
76
|
-
end
|
77
|
-
|
78
|
-
public
|
79
|
-
def has_is_skip_by_key
|
80
|
-
return defined?(is_skip_by_key) == 'method'
|
81
|
-
end
|
82
|
-
|
83
|
-
public
|
84
|
-
def load_is_skip_by_key(sheetname, key)
|
85
|
-
return is_skip_by_key(sheetname, key)
|
86
|
-
end
|
87
|
-
|
88
|
-
end
|
89
|
-
end
|