fastlane-plugin-google_sheet_localize 0.3.02 → 0.3.10
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ad1b088723de465606267fc7cd2da89753d60c51f3c36607591320b66cb8152
|
4
|
+
data.tar.gz: afbc9b0390d111892e3f2c408a5b7f3f5339b53ffff9c9bac2bb2d2e23aee83e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,12 +188,12 @@ 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\
|
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']
|
194
195
|
|
195
|
-
values = identifier.dup.split(
|
196
|
+
values = identifier.dup.split(/\.|_/)
|
196
197
|
|
197
198
|
constantName = ""
|
198
199
|
|
@@ -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("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}")
|
@@ -238,24 +239,19 @@ module Fastlane
|
|
238
239
|
if comment.to_s.empty?
|
239
240
|
return %Q(
|
240
241
|
/**
|
241
|
-
- Example:
|
242
|
-
````
|
243
242
|
#{example}
|
244
|
-
````
|
245
243
|
*/
|
246
244
|
)
|
247
245
|
end
|
248
246
|
|
249
247
|
return %Q(
|
250
248
|
/**
|
249
|
+
#{example}
|
250
|
+
|
251
251
|
- Sheet comment:
|
252
252
|
````
|
253
253
|
#{comment}
|
254
254
|
````
|
255
|
-
- Example:
|
256
|
-
````
|
257
|
-
#{example}
|
258
|
-
````
|
259
255
|
*/
|
260
256
|
)
|
261
257
|
end
|
@@ -293,7 +289,6 @@ module Fastlane
|
|
293
289
|
line = "\n\n#{identifier}\n"
|
294
290
|
else
|
295
291
|
|
296
|
-
if !text.include?("one|")
|
297
292
|
|
298
293
|
if (text == "" || text == "TBD") && !defaultLanguage.to_s.empty?
|
299
294
|
default_language_object = languages.select { |languageItem| languageItem['language'] == defaultLanguage }.first["items"]
|
@@ -304,6 +299,8 @@ module Fastlane
|
|
304
299
|
text = self.mapInvalidPlaceholder(defaultLanguageText)
|
305
300
|
end
|
306
301
|
|
302
|
+
if !text.include?("one|")
|
303
|
+
|
307
304
|
matches = text.scan(/%[0-9][sdf]/)
|
308
305
|
|
309
306
|
matches.each { |match|
|
@@ -334,7 +331,6 @@ module Fastlane
|
|
334
331
|
text = self.mapInvalidPlaceholder(item['text'])
|
335
332
|
identifier = item['identifier']
|
336
333
|
|
337
|
-
if !identifier.include?('//') && text.include?("one|")
|
338
334
|
if (text == "" || text == "TBD") && !defaultLanguage.to_s.empty?
|
339
335
|
default_language_object = languages.select { |languageItem| languageItem['language'] == defaultLanguage }.first["items"]
|
340
336
|
default_language_object = self.filterUnusedRows(default_language_object,'identifier', "false")
|
@@ -344,6 +340,8 @@ module Fastlane
|
|
344
340
|
text = self.mapInvalidPlaceholder(defaultLanguageText)
|
345
341
|
end
|
346
342
|
|
343
|
+
if !identifier.include?('//') && text.include?("one|")
|
344
|
+
|
347
345
|
text = text.gsub("\n", "|")
|
348
346
|
|
349
347
|
formatIdentifier = identifier.gsub(".", "")
|
@@ -436,6 +434,9 @@ module Fastlane
|
|
436
434
|
line = line + " <string-array name=\"#{identifier}\">\n"
|
437
435
|
|
438
436
|
JSON.parse(text).each { |arrayItem|
|
437
|
+
|
438
|
+
arrayItem = arrayItem.gsub("'", "\\\\'")
|
439
|
+
|
439
440
|
line = line + " <item><![CDATA[#{arrayItem}]]></item>\n"
|
440
441
|
}
|
441
442
|
|
@@ -476,8 +477,8 @@ module Fastlane
|
|
476
477
|
\n})
|
477
478
|
end
|
478
479
|
|
479
|
-
def self.createiOSFunction(constantName, identifier, arguments)
|
480
|
-
functionTitle = "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
|
|
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.
|
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:
|
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
|
-
|
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
|