fastlane-plugin-google_sheet_localize 0.3.06 → 0.3.10

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: 8cd7e38197a7a899f0babccc4dd007133de1f45a4f75cd8164161b77a380d0be
4
- data.tar.gz: 6aae195e79318258190b3a8b1d2dd68977589c771f7a746ecb48e4e04522dd3a
3
+ metadata.gz: 6ad1b088723de465606267fc7cd2da89753d60c51f3c36607591320b66cb8152
4
+ data.tar.gz: afbc9b0390d111892e3f2c408a5b7f3f5339b53ffff9c9bac2bb2d2e23aee83e
5
5
  SHA512:
6
- metadata.gz: b3d4cee30ff65e35d313138b8deb8644596dc517d1c2f4517b073506a9cd5e546b082cc3f899fda617188197a29f5fbe05c4395786a48c0fcc8dc6d3dbdbe973
7
- data.tar.gz: b1a107ece3531c4ee3ccdb57fec4c108540ea4f14689a1a1d5fa14b083f33621687f4afbc7f284d60301f3c4416c4a4cca55a151602eacefa6947a6cca5cd015
6
+ metadata.gz: 309965ccd5cbf39742863d369d6cdd50570714feec7f5fe678c21a12bd85b60e6dcfe4bc937bbb3caa29b65a806d917c3ff2072444bc561bcbe094148805569a
7
+ data.tar.gz: 2f1a279e8f808e85d26bf6134457340b9f6610a5dd121249e68adf508260095b7d43d9f09b03f6510fd7b7459e6fed142a7750f10e156cc586ec21f9885bbdf4
data/README.md CHANGED
@@ -41,6 +41,11 @@ other|%d artists
41
41
  #### String Array: (Android)
42
42
  ["Monday", "Tuesday", "Wednesday"]
43
43
 
44
+ ## iOS specifics
45
+
46
+ In order to support Objective-C, the plugin provides the `support_objc` argument, which is default `false`.
47
+ Therefore, if you need Objective-C support pass `support_objc: true`.
48
+
44
49
  ## Example
45
50
 
46
51
  ```ruby
@@ -20,6 +20,7 @@ module Fastlane
20
20
  code_generation_path = params[:code_generation_path]
21
21
  identifier_name = params[:identifier_name]
22
22
  comment_example_language = params[:comment_example_language]
23
+ support_objc = params[:support_objc]
23
24
 
24
25
  if identifier_name.to_s.empty?
25
26
  if platform == "ios"
@@ -85,7 +86,7 @@ module Fastlane
85
86
  end
86
87
  end
87
88
  }
88
- self.createFiles(result, platform, path, default_language, base_language, code_generation_path, comment_example_language)
89
+ self.createFiles(result, platform, path, default_language, base_language, code_generation_path, comment_example_language, support_objc)
89
90
  end
90
91
 
91
92
  def self.generateJSONObject(contentRows, index, identifierIndex)
@@ -131,7 +132,7 @@ module Fastlane
131
132
  }
132
133
  end
133
134
 
134
- def self.createFiles(languages, platform, destinationPath, defaultLanguage, base_language, codeGenerationPath, comment_example_language)
135
+ def self.createFiles(languages, platform, destinationPath, defaultLanguage, base_language, codeGenerationPath, comment_example_language, support_objc)
135
136
  self.createFilesForLanguages(languages, platform, destinationPath, defaultLanguage, base_language)
136
137
 
137
138
  if platform == "web"
@@ -187,7 +188,7 @@ module Fastlane
187
188
  swiftFilepath = "#{swiftPath}/#{swiftFilename}"
188
189
 
189
190
  File.open(swiftFilepath, "w") do |f|
190
- f.write("import Foundation\n\n// swiftlint:disable all\npublic class Localization: NSObject {\n")
191
+ f.write("import Foundation\n\n// swiftlint:disable all\n#{getiOSTypeDefinition(support_objc)} {\n")
191
192
  filteredItems.each { |item|
192
193
 
193
194
  identifier = item['identifier']
@@ -220,10 +221,10 @@ module Fastlane
220
221
 
221
222
  if arguments.count == 0
222
223
  f.write(self.createComment(item['comment'], item['text']))
223
- f.write("@objc public static let #{constantName} = localized(identifier: \"#{identifier}\")\n")
224
+ f.write("#{getiOSAttributes(support_objc)}public static let #{constantName} = localized(identifier: \"#{identifier}\")\n")
224
225
  else
225
226
  f.write(self.createComment(item['comment'], item['text']))
226
- f.write(self.createiOSFunction(constantName, identifier, arguments))
227
+ f.write(self.createiOSFunction(constantName, identifier, arguments, support_objc))
227
228
  end
228
229
  }
229
230
  f.write("\n}")
@@ -476,8 +477,8 @@ module Fastlane
476
477
  \n})
477
478
  end
478
479
 
479
- def self.createiOSFunction(constantName, identifier, arguments)
480
- functionTitle = "@objc public static func #{constantName}("
480
+ def self.createiOSFunction(constantName, identifier, arguments, support_objc)
481
+ functionTitle = "#{getiOSAttributes(support_objc)}public static func #{constantName}("
481
482
 
482
483
  arguments.each_with_index do |item, index|
483
484
  functionTitle = functionTitle + "_ arg#{index}: #{item[:type]}"
@@ -500,6 +501,14 @@ module Fastlane
500
501
  return functionTitle
501
502
  end
502
503
 
504
+ def self.getiOSTypeDefinition(support_objc)
505
+ return support_objc ? "public class Localization: NSObject" : "public struct Localization"
506
+ end
507
+
508
+ def self.getiOSAttributes(support_objc)
509
+ return support_objc ? "@objc " : ""
510
+ end
511
+
503
512
  def self.findArgumentsInText(text)
504
513
 
505
514
  if text.include?("one|")
@@ -614,7 +623,12 @@ module Fastlane
614
623
  env_name: "CODEGENERATIONPATH",
615
624
  description: "Code generation path for the Swift file",
616
625
  optional: true,
617
- type: String)
626
+ type: String),
627
+ FastlaneCore::ConfigItem.new(key: :support_objc,
628
+ env_name: "OBJC_SUPPORT",
629
+ description: "Whether the generated code should support Obj-C. Only relevant for the ios platform",
630
+ type: Boolean,
631
+ default_value: false)
618
632
  ]
619
633
  end
620
634
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module GoogleSheetLocalize
3
- VERSION = "0.3.06"
3
+ VERSION = "0.3.10"
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.3.06
4
+ version: 0.3.10
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-10-07 00:00:00.000000000 Z
11
+ date: 2020-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google_drive
@@ -181,8 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  - !ruby/object:Gem::Version
182
182
  version: '0'
183
183
  requirements: []
184
- rubyforge_project:
185
- rubygems_version: 2.7.7
184
+ rubygems_version: 3.0.3
186
185
  signing_key:
187
186
  specification_version: 4
188
187
  summary: Creates .strings files for iOS and strings.xml files for Android