locraft 1.3.1 → 1.4.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/locraft/config.rb +2 -0
- data/lib/locraft/csv_parser.rb +6 -2
- data/lib/locraft/localization.rb +2 -1
- data/lib/locraft/resources/sample_locraft.config +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 585cc878bec06aabeb780f92d6fdd1fabb16daf0
|
4
|
+
data.tar.gz: 6589e550e52cbb96f59b79e35af0928a11fdeb94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fcc07735e43f7ffd3e2ded9ea69b817b9e1d088cfaf78b5817710862665b9023aa03a127818809e0a8fad7065d222a9eba6790a02765133c1e186f39fd274f0
|
7
|
+
data.tar.gz: 1026ace142c16d6f13621f584ba3b28107cc1f3f329fb7ca8fe9451cc1bccc923153a9421ba8fdfb78d54225d52146d82779a0fb1533e395cbddbed751213f35
|
data/lib/locraft/config.rb
CHANGED
@@ -12,6 +12,7 @@ module Locraft
|
|
12
12
|
attr_accessor :gdoc_comments_column
|
13
13
|
attr_accessor :dev_lang
|
14
14
|
attr_accessor :dev_prefix
|
15
|
+
attr_accessor :keys_map
|
15
16
|
attr_accessor :macro_file
|
16
17
|
attr_accessor :macro_destination
|
17
18
|
attr_accessor :strings_basename
|
@@ -29,6 +30,7 @@ module Locraft
|
|
29
30
|
self.gdoc_comments_column = 'Comments'
|
30
31
|
self.dev_lang = OBJC
|
31
32
|
self.dev_prefix = 'XYZ'
|
33
|
+
self.keys_map = {}
|
32
34
|
self.macro_file = 'LocalizedConstants'
|
33
35
|
self.macro_destination = './'
|
34
36
|
self.strings_basename = 'Localizable'
|
data/lib/locraft/csv_parser.rb
CHANGED
@@ -18,14 +18,18 @@ module Locraft
|
|
18
18
|
rows = csv_rows(csv_body)
|
19
19
|
localizations_hash = {}
|
20
20
|
@config.langs.keys.each do |lang|
|
21
|
-
localizations_hash[lang] = parse_rows_for_lang(rows, lang)
|
21
|
+
localizations_hash[lang] = parse_rows_for_lang(rows, lang) || []
|
22
22
|
end
|
23
23
|
localizations_hash
|
24
24
|
end
|
25
25
|
|
26
26
|
# return localizations array
|
27
27
|
def parse_rows_for_lang(rows, lang)
|
28
|
-
rows.
|
28
|
+
if rows.first.keys.include? lang
|
29
|
+
rows.map { |row| Localization.load_with_csv_row(row, @config, lang) }
|
30
|
+
else
|
31
|
+
warn "WARNING: there is no such a language in doc file: [#{lang}]"
|
32
|
+
end
|
29
33
|
end
|
30
34
|
end
|
31
35
|
end
|
data/lib/locraft/localization.rb
CHANGED
@@ -9,8 +9,9 @@ module Locraft
|
|
9
9
|
localization = Localization.new
|
10
10
|
localization.language = lang
|
11
11
|
localization.comment = row[config.gdoc_comments_column]&.strip
|
12
|
-
localization.key = (row[config.gdoc_keys_column] || row[config.default_lang])&.strip
|
13
12
|
localization.value = (row[lang] || row[config.default_lang])&.strip
|
13
|
+
key = (row[config.gdoc_keys_column] || row[config.default_lang])&.strip
|
14
|
+
localization.key = config.keys_map[key] || key
|
14
15
|
localization
|
15
16
|
end
|
16
17
|
|
@@ -10,14 +10,14 @@ Locraft::Config.new do |conf|
|
|
10
10
|
conf.langs = {
|
11
11
|
'English' => 'en',
|
12
12
|
'Russian' => 'ru'
|
13
|
-
} # default: {'English' => 'en', 'Russian' => 'ru'}
|
14
|
-
|
13
|
+
} # default: { 'English' => 'en', 'Russian' => 'ru' }
|
15
14
|
conf.default_lang = 'English' # default: 'English'
|
16
15
|
conf.gdoc_sheet = 0 # default: 0
|
17
16
|
conf.gdoc_keys_column = 'Keys' # default: 'Keys'
|
18
17
|
conf.gdoc_comments_column = 'Comments' # default: 'Comments'
|
19
|
-
conf.dev_prefix = 'XYZ' # default: 'XYZ'
|
20
18
|
conf.dev_lang = OBJC # OBJC or SWIFT, default: OBJC
|
19
|
+
conf.dev_prefix = 'XYZ' # default: 'XYZ'
|
20
|
+
conf.keys_map = {}
|
21
21
|
conf.macro_file = 'LocalizedConstants' # default: 'LocalizedConstants'
|
22
22
|
conf.macro_destination = './' # default: './'
|
23
23
|
conf.strings_basename = 'Localizable' # default: 'Localizable'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: locraft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sroik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google_drive
|