applocale 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 DIRNAME_MAIN + "/Resource"
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
- pathstr = Pathname.new(str.strip)
67
- if File.directory?(pathstr)
68
- pathstr = File.join(self.configfile_pathstr, FilePathUtil.default_config_filename).to_s
69
- end
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
 
@@ -4,7 +4,7 @@ require File.expand_path('../platform.rb', __FILE__)
4
4
 
5
5
  module Applocale
6
6
  class ValidKey
7
- REGEX_KEYSTR_IOS = /\A[0-9a-zA-Z_]+\z/
7
+ REGEX_KEYSTR_IOS = /\A[0-9a-zA-Z_\/]+\z/
8
8
 
9
9
  def self.is_validkey(platfrom, key)
10
10
  return false if key.nil?
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Applocale
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.1
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-05-31 00:00:00.000000000 Z
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.7.7
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