fastlane-plugin-google_sheet_localize 0.2.08 → 0.2.09

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d7de3c4d7121b4e4951eedee63a9e52be35327ee78ad9b21596ef94a1ba7e98
4
- data.tar.gz: fbf9f07fc2ccb22cb88132473e353bdbd07d51b81bbd79f968b259fa0e33488e
3
+ metadata.gz: c02b39d49637a3b72336364ffd713da0ae15204ad348962f117c3f30b5422aad
4
+ data.tar.gz: dfd52c7a2444fce1704fcf33ff1f729857dad852b7246f56c793a6997ff3a404
5
5
  SHA512:
6
- metadata.gz: 71ba498f21335ec969a77a330e3f99301fd07cfeb4255b13751253a900f02f03d357429288f28bb6167e96c75d9aedc2998df2ca284f51a1781aeb4a62f7d4ff
7
- data.tar.gz: 96f8197af3ffb73bc768932f79251ae5a28e8eee4ee833f04a6f58e06ab66f913f4df7acdcd28596f29f732713bf85f96a6d093894f9eba00e5873878ea94be7
6
+ metadata.gz: 8d4c5a96a6d0361096db40551b990f6a8de1a72c028df16aa27cc15d8ef6c6e4e4520a4e460f949b2c632fad2e64ed5d0ed6fed03d5b4ee8e9b098fe6a47cf05
7
+ data.tar.gz: a07b2c145f2a54eebe98dba7b201c401416cc9a3bd3fa023733f2a5431559f0908a846735da4b64525679f702ddf59a484874e580ee6328f7706b54050e03aa4
data/README.md CHANGED
@@ -24,6 +24,16 @@ Google Drive access token: [_Guide_](https://medium.com/@osanda.deshan/getting-g
24
24
 
25
25
  ## Sheet Language
26
26
 
27
+ #### Arguments: (Android + iOS + Web)
28
+ English: `Mario ate a %2s %1s`.
29
+ German: `Mario hat %1s einen %2s gegessen`.
30
+
31
+ In this case `%2s` stands for __Apple__ and `%1s` for __Today__, the order is different in this example, so we need to take care of it.
32
+
33
+ Mapped iOS: `Mario ate a %2$@ %1$@`.
34
+ Mapped Android: `Mario ate a %2s %1s`.
35
+ Mapped Web: `Mario ate a {2} {1}`.
36
+
27
37
  #### Plurals: (Android + iOS)
28
38
  one|%d artist
29
39
  other|%d artists
@@ -33,46 +33,54 @@ module Fastlane
33
33
  end
34
34
 
35
35
  spreadsheet = session.spreadsheet_by_url(spreadsheet_id)
36
- worksheet = spreadsheet.worksheets.first
37
36
 
38
- result = []
37
+ filterdWorksheets = []
39
38
 
40
- for i in 0..worksheet.max_cols
39
+ if tabs.count == 0
40
+ filterdWorksheets = spreadsheet.worksheets
41
+ else
42
+ filterdWorksheets = spreadsheet.worksheets.select { |item| tabs.include?(item.title) }
43
+ end
41
44
 
42
- title = worksheet.rows[0][i]
45
+ result = []
46
+
47
+ filterdWorksheets.each { |worksheet|
43
48
 
44
- if language_titles.include?(title)
49
+ identifierIndex = 0
45
50
 
46
- language = {
47
- 'language' => title,
48
- 'items' => []
49
- }
51
+ for i in 0..worksheet.max_cols
52
+ if worksheet.rows[0][i] == identifier_name
53
+ identifierIndex = i
54
+ end
55
+ end
50
56
 
51
- filterdWorksheets = []
57
+ for i in 0..worksheet.max_cols
52
58
 
53
- if tabs.count == 0
54
- filterdWorksheets = spreadsheet.worksheets
55
- else
56
- filterdWorksheets = spreadsheet.worksheets.select { |item| tabs.include?(item.title) }
57
- end
59
+ title = worksheet.rows[0][i]
58
60
 
59
- filterdWorksheets.each { |worksheet|
60
- identifierIndex = 0
61
+ if language_titles.include?(title)
61
62
 
62
- for index in 0..worksheet.max_cols
63
- if worksheet.rows[0][index] == identifier_name
64
- identifierIndex = index
65
- end
63
+ language = result.select { |item| item['language'] == title }.first
64
+
65
+ if language.nil?
66
+ language = {
67
+ 'language' => title,
68
+ 'items' => []
69
+ }
66
70
  end
67
71
 
68
72
  contentRows = worksheet.rows.drop(1)
69
- language['items'].concat(self.generateJSONObject(contentRows, i, identifierIndex))
70
- }
71
73
 
72
- result.push(language)
74
+ items = language['items']
75
+ items = items + self.generateJSONObject(contentRows, i, identifierIndex)
76
+
77
+ language['items'] = items
78
+
79
+ result.push(language)
80
+ end
73
81
  end
74
- end
75
- self.createFiles(result, platform, path, default_language, base_language, code_generation_path)
82
+ }
83
+ self.createFiles(result, platform, path, default_language, base_language, code_generation_path)
76
84
  end
77
85
 
78
86
  def self.generateJSONObject(contentRows, index, identifierIndex)
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module GoogleSheetLocalize
3
- VERSION = "0.2.08"
3
+ VERSION = "0.2.09"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-google_sheet_localize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.08
4
+ version: 0.2.09
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Hahn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-20 00:00:00.000000000 Z
11
+ date: 2019-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google_drive