fastlane-plugin-google_sheet_localize 0.1.62 → 0.1.63

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
  SHA256:
3
- metadata.gz: e2a5b148feb10990de9fc299ee5b885f13b81558404549934b3dea242d3d3588
4
- data.tar.gz: 1ea19cbdab4d86334cf6c45ba3a8da63cd180d5882454d72ca5ab30c336e23d4
3
+ metadata.gz: 102188576599a79430b403b7f1281392f5d1561b13ccd8d0e98cbe1b180bd484
4
+ data.tar.gz: f48b48392ea363cede16ebf8b1e9f59209d2bf999393d126fb07ee67889ffe56
5
5
  SHA512:
6
- metadata.gz: 9c03d350f56fb338c9c38f509bb9524034ae9dc047d5e04dee190410871a6fe74f5185227d7f718b73a3eeb3ecf713ab91d40059ae51b9a8c86eadb82239b2de
7
- data.tar.gz: c79affce8ad07e67abe628ceeff9fe07784f762b196c728379f808596c275c537d045de2739e74e77f4decb3470990f7bfe94116d7ce16b3363e1642cf62e0a1
6
+ metadata.gz: f8d38dffd11d365c4cf3062f5c16c6a8dc2e01448d2460faf36bb11d6ecc94f6818d1f4f7b268f5b5b6a1b64173590daf432dcdd84ea62b625767f639e162073
7
+ data.tar.gz: 1239bcada1be1cf536d58e29cb1c6ec3cfc2bcb58990424e3fc89b7083a60c345c3bef8d618a34c3f5fcd80ca16efaf22671bdf4845287bd552d7586e2203ce9
data/README.md CHANGED
@@ -14,13 +14,25 @@ fastlane add_plugin google_sheet_localize
14
14
 
15
15
  Creates .strings files for iOS and strings.xml files for Android
16
16
 
17
- **Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
17
+ to use our plugin you have to duplicate this google sheet: https://docs.google.com/spreadsheets/d/1fwRj1ZFPu2XlrDqkaqmIpJulqR5OVFEZnN35a9v37yc/edit?usp=sharing
18
+
19
+ Google Drive access token:
20
+ https://medium.com/@osanda.deshan/getting-google-oauth-access-token-using-google-apis-18b2ba11a11a
18
21
 
19
22
  ## Example
20
23
 
21
- Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
24
+ ```bash
25
+ lane :localize do
26
+ google_sheet_localize(service_account_path: "./fastlane/google_drive_credentials.json",
27
+ sheet_id: "sheet id",
28
+ platform: "ios",
29
+ tabs: ["3TV"],
30
+ localization_path: "./Kit/TVKit",
31
+ language_titles: ["de", "en"],
32
+ default_language: "de")
33
+ end
34
+ ```
22
35
 
23
- **Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
24
36
 
25
37
  ## Run tests for this plugin
26
38
 
@@ -195,7 +195,10 @@ module Fastlane
195
195
  File.open("#{destinationPath}/#{languageDir}/strings.xml", "w") do |f|
196
196
  f.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
197
197
  f.write("<resources>\n")
198
- language["items"].each { |item|
198
+
199
+ filteredItems = self.filterUnusedRows(language["items"],'identifierAndroid')
200
+
201
+ filteredItems.each { |item|
199
202
 
200
203
  comment = item['comment']
201
204
  identifier = item['identifierAndroid']
@@ -208,6 +211,15 @@ module Fastlane
208
211
  line = line + "\t<!--#{comment}-->\n"
209
212
  end
210
213
 
214
+ if text == "" || text == "TBD"
215
+ default_language_object = languages.select { |languageItem| languageItem['language'] == defaultLanguage }.first["items"]
216
+ default_language_object = self.filterUnusedRows(default_language_object,'identifierAndroid')
217
+
218
+ defaultLanguageText = default_language_object[index]['text']
219
+ puts "found empty text for identifier: #{identifier} for language:#{language['language']}, replaceing it with #{defaultLanguageText}"
220
+ text = defaultLanguageText
221
+ end
222
+
211
223
  line = line + "\t<string name=\"#{identifier}\"><![CDATA[#{text}]]></string>\n"
212
224
 
213
225
  f.write(line)
@@ -220,14 +232,13 @@ module Fastlane
220
232
  end
221
233
 
222
234
  def self.createiOSFileEndString()
223
- return "\n\nextension Localization {\n\tprivate static func localized(identifier key: String, _ args: CVarArg...) -> String {\n\t\tlet format = NSLocalizedString(key, tableName: nil, bundle: Bundle.main, comment: \"\")\n\n\t\tguard !args.isEmpty else { return format }\n\n\t\treturn String(format: format, locale: Locale.current, arguments: args)\n\t}\n}"
235
+ return "\n\nprivate class LocalizationHelper { }\n\nextension Localization {\n\tprivate static func localized(identifier key: String, _ args: CVarArg...) -> String {\n\t\tlet format = NSLocalizedString(key, tableName: nil, bundle: Bundle(for: LocalizationHelper.self), comment: \"\")\n\n\t\tguard !args.isEmpty else { return format }\n\n\t\treturn String(format: format, locale: Locale.current, arguments: args)\n\t}\n}"
224
236
  end
225
237
 
226
238
  def self.createiOSFunction(constantName, identifier, arguments, comment)
227
239
  functionTitle = "\n\t///Sheet comment: #{comment}\n\tpublic static func #{constantName}("
228
240
 
229
241
  arguments.each_with_index do |item, index|
230
- puts item
231
242
  functionTitle = functionTitle + "_ arg#{index}: #{item[:type]}"
232
243
  if index < arguments.count - 1
233
244
  functionTitle = functionTitle + ", "
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module GoogleSheetLocalize
3
- VERSION = "0.1.62"
3
+ VERSION = "0.1.63"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-google_sheet_localize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.62
4
+ version: 0.1.63
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Hahn