applocale 0.2.5 → 0.2.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c867fde40c4818fa8274896d0386329514bc356b
4
- data.tar.gz: 572063f121578458ff781751eda3a4a5ca7104ca
3
+ metadata.gz: 06a01f99dce9df71c355dfbe1a03b85fac6cb9b4
4
+ data.tar.gz: 8b7a559af7ab08cf16284bee8d78eb37277ac35f
5
5
  SHA512:
6
- metadata.gz: e77ca0d49da189afc99bc5d94a16dc600c9bc53bde9bb26c99456e53a158059bb89f78bcb63ca503516a7ec4e98b260018221b73374bdf727bc6acc541a03f4c
7
- data.tar.gz: 4fe91b4192ac5a3cb4b4d861a07f18cdf03bc039e3b8c4a27e0743d37143b41a736fe46dde4c85701f9675ac6401f9a6eef8d4137e55db4d91728122c2513d0e
6
+ metadata.gz: 86e57f20ab0ea767f5dc54a1e15d9d20b6d97fb467bcfd4786ec3a93217922b75d225d39bbd4d5bd0a11b2201bea49137e922cb6a391f31d09d60f6f99b94c0e
7
+ data.tar.gz: 64ecc8367c813080d9cc9a48304e1f8dff02955d319de749458134156528fd189bac8e119b38259cd8e9c94d190c8ec95ec3f8605a6da319d3605203fb0c6415
@@ -1,7 +1,7 @@
1
1
  link: "https://docs.google.com/spreadsheets/d/1Wy2gN_DSw-TCU2gPCzqvYxLfFG5fyK5rodXs5MLUy8w"
2
2
  platform: "#{platform}"
3
3
  xlsxpath: "#{xlsxpath}"
4
- export_format: :#{export_format}
4
+ export_format: "#{export_format}"
5
5
  #google_credentials_path: "#{google_credentials_path}"
6
6
  langlist:
7
7
  zh_TW: "#{path_zh_TW}"
@@ -28,10 +28,43 @@ module Applocale
28
28
 
29
29
  def self.convert_to_stringfile(platform, langpath_obj, sheetcontent_list, injectObj)
30
30
  FileUtils.mkdir_p(File.dirname(langpath_obj.filepath))
31
+ file_header_comment = []
32
+ is_double_dash_comment = false
33
+ is_multiline_comment = false
34
+ File.open(langpath_obj.filepath, 'r').each do |line|
35
+ if is_double_dash_comment
36
+ break unless line.strip.start_with?('//')
37
+ file_header_comment.push(line)
38
+ next
39
+ end
40
+
41
+ if is_multiline_comment
42
+ file_header_comment.push(line)
43
+ break if line.include?('*/')
44
+ end
45
+
46
+ unless is_multiline_comment or is_double_dash_comment
47
+ case
48
+ when line.chomp.empty?
49
+ file_header_comment.push(line)
50
+ when line.strip.start_with?('//')
51
+ is_double_dash_comment = true
52
+ file_header_comment.push(line)
53
+ when line.strip.start_with?('/*') && !line.strip.start_with?('/**')
54
+ is_multiline_comment = true
55
+ file_header_comment.push(line)
56
+ else
57
+ break
58
+ end
59
+ end
60
+ end
61
+
31
62
  target = open(langpath_obj.filepath, 'w')
32
- sheetcontent_list.each do |sheetcontent|
63
+ target.puts file_header_comment.join('') if is_double_dash_comment or is_multiline_comment
64
+ sheetcontent_list.each_with_index do |sheetcontent, index|
33
65
  contentlist = sheetcontent.get_rowInfo_sortby_key
34
66
  next if contentlist.length <= 0
67
+ target.puts('') if index > 0 or !file_header_comment.empty?
35
68
  target.puts('/*******************************')
36
69
  target.puts(" * #{sheetcontent.comment}")
37
70
  target.puts(' *******************************/')
@@ -41,7 +74,6 @@ module Applocale
41
74
  value = self.add_escape(platform, langpath_obj.lang, rowinfo.key_str, content, injectObj)
42
75
  target.puts("\"#{rowinfo.key_str}\" = \"#{value}\";")
43
76
  end
44
- target.puts('')
45
77
  end
46
78
  target.close
47
79
  end
@@ -107,6 +107,7 @@ module Applocale
107
107
  end
108
108
  end
109
109
 
110
+ export_format = 'xlsx' if export_format.nil?
110
111
  case export_format
111
112
  when 'csv', 'xlsx'
112
113
  setting.export_format = export_format
@@ -1,3 +1,3 @@
1
1
  module Applocale
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.7"
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.2.5
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kennix
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-19 00:00:00.000000000 Z
11
+ date: 2018-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  version: '0'
174
174
  requirements: []
175
175
  rubyforge_project:
176
- rubygems_version: 2.6.10
176
+ rubygems_version: 2.6.14
177
177
  signing_key:
178
178
  specification_version: 4
179
179
  summary: for mobile application to manage locale