fastlane-plugin-google_sheet_localize 0.1.99 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1687b2bd2a17284ad02aa07d130b32b32eb7f67686db2c20f47067a8b0fa470b
4
- data.tar.gz: fdc685a6b3d44eafd823eb305068a4578b378832575805908d98ca27ee155856
3
+ metadata.gz: dc76a11f3d9efb92d3a5b64fe692c5752a98cf27efaa9d66449b52683d4a1ffc
4
+ data.tar.gz: 3e4a4fe70a87277f917b639fab88c56c82f37042e3edc7f4cdb3d231df79900b
5
5
  SHA512:
6
- metadata.gz: 59209bd5e5eb7d47b8b816811aa3713b7f8c231fa4409e68f9555e9a7793d4b088a12ee27736b6884c6499a60f0d6714af1eab54d0c7805990ec59bcfd919994
7
- data.tar.gz: f7da7bcf9220a6148678be6ed43d9699fd42667c8dfb40f8343deee6b5da84219ecc58c54f4152c42909a107b250b1bc62bfc5e546bcddadff35c90d68dd5430
6
+ metadata.gz: ff3c79061b0eac4c9012123f3c6bb607b6b86c3d547230f0ee0558f61ce53df12b773fe3e39a6adb76724a57055e782d0392dfa1c7376e42a6768b813a7e6962
7
+ data.tar.gz: 812fff8313d088a1386ab84e96769bb4f9417fb6e550212e08b22d992cd3b385ac772122739d4aa05ce3b7b62bdd1891a410723c28874aee9d8e1d36735ff9a0
@@ -279,47 +279,45 @@ module Fastlane
279
279
  identifier = item['identifierAndroid']
280
280
  text = item['text']
281
281
 
282
- if !identifier.to_s.empty?
283
- line = ""
282
+ line = ""
284
283
 
285
- if !comment.to_s.empty?
286
- line = line + "\t<!--#{comment}-->\n"
287
- end
284
+ if !comment.to_s.empty?
285
+ line = line + "\t<!--#{comment}-->\n"
286
+ end
288
287
 
289
- if text == "" || text == "TBD"
290
- default_language_object = languages.select { |languageItem| languageItem['language'] == defaultLanguage }.first["items"]
291
- default_language_object = self.filterUnusedRows(default_language_object,'identifierAndroid')
288
+ if text == "" || text == "TBD"
289
+ default_language_object = languages.select { |languageItem| languageItem['language'] == defaultLanguage }.first["items"]
290
+ default_language_object = self.filterUnusedRows(default_language_object,'identifierAndroid')
292
291
 
293
- defaultLanguageText = default_language_object[index]['text']
294
- puts "found empty text for:\n\tidentifier: #{identifier}\n\tlanguage:#{language['language']}\n\treplacing it with: #{defaultLanguageText}"
295
- text = defaultLanguageText
296
- end
292
+ defaultLanguageText = default_language_object[index]['text']
293
+ puts "found empty text for:\n\tidentifier: #{identifier}\n\tlanguage:#{language['language']}\n\treplacing it with: #{defaultLanguageText}"
294
+ text = defaultLanguageText
295
+ end
297
296
 
298
- text = text.gsub(/\\?'/, "\\\\'")
297
+ text = text.gsub(/\\?'/, "\\\\'")
299
298
 
300
- if text.include?("one|")
299
+ if text.include?("one|")
301
300
 
302
- text = text.gsub("\n", "|")
301
+ text = text.gsub("\n", "|")
303
302
 
304
- line = line + "\t<plurals name=\"#{identifier}\">\n"
303
+ line = line + "\t<plurals name=\"#{identifier}\">\n"
305
304
 
306
- plural = ""
305
+ plural = ""
307
306
 
308
- text.split("|").each_with_index { |word, wordIndex|
309
- if wordIndex % 2 == 0
310
- plural = "\t\t<item quantity=\"#{word}\">"
311
- else
312
- plural = plural + "<![CDATA[\"#{word}\"]]></item>\n"
313
- line = line + plural
314
- end
315
- }
316
- line = line + "\t</plurals>\n"
317
- else
318
- line = line + "\t<string name=\"#{identifier}\"><![CDATA[#{text}]]></string>\n"
319
- end
320
-
321
- f.write(line)
307
+ text.split("|").each_with_index { |word, wordIndex|
308
+ if wordIndex % 2 == 0
309
+ plural = "\t\t<item quantity=\"#{word}\">"
310
+ else
311
+ plural = plural + "<![CDATA[\"#{word}\"]]></item>\n"
312
+ line = line + plural
313
+ end
314
+ }
315
+ line = line + "\t</plurals>\n"
316
+ else
317
+ line = line + "\t<string name=\"#{identifier}\"><![CDATA[#{text}]]></string>\n"
322
318
  end
319
+
320
+ f.write(line)
323
321
  }
324
322
  f.write("</resources>\n")
325
323
  end
@@ -328,7 +326,7 @@ module Fastlane
328
326
  end
329
327
 
330
328
  def self.createiOSFileEndString()
331
- 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\tString(format: format, locale: .current, arguments: args)\n\t}\n}"
329
+ 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: .current, arguments: args)\n\t}\n}"
332
330
  end
333
331
 
334
332
  def self.createiOSFunction(constantName, identifier, arguments, comment)
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module GoogleSheetLocalize
3
- VERSION = "0.1.99"
3
+ VERSION = "0.2.0"
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.99
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Hahn