fastlane-plugin-google_sheet_localize 0.3.11 → 0.4.1

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: 9b5d87c095c7e5ca644cad2b1843e389dc0772a30f10ee213fb21e8d5bb64e14
4
- data.tar.gz: d85062c292448a24ca74fce441cb57369a588d30a3581f4929281bf605acbb3f
3
+ metadata.gz: ebe380844be5865d1b1522227cfa03271b371d4a7d2e2ab165b3d8e57507b7aa
4
+ data.tar.gz: b1d87a00e2f03b343032f43c394ec9baa0909232863ffeb0b21fd8790ebc8c1d
5
5
  SHA512:
6
- metadata.gz: 129d2376d444e9b473a455085a7b1fd58ced4a95820f4a8dd339a3c8e0021e44f505bee4c6cbdfd522200a6033017653230cfd78dded79259a09375d4141221e
7
- data.tar.gz: 1130f9c3f659b4b0ad46c7d09745fb002cce7d16b3de2fc78c32e14121d84f57d733e4b8ee2c62e999a5d077149bd57d73a9e2f8342d41378ff5500548e9ca0f
6
+ metadata.gz: 464c2ae7ee9ed2424a60b45889e8e94756a021d010f3d2f9dbbffb716a8c0751a822923e7e1a3eaa66bee44f1388d1ffa0108e49dc2d59d623d99d8f442f945c
7
+ data.tar.gz: 25ac9c540f9dce77d875fd0d8cd2893c8624ff03e17b6fae9e4b43900e56406c8fc198db8c833c6b94e784dce1e72fbb76b026b0c6bab8d82adb7230034586ff
@@ -302,11 +302,7 @@ module Fastlane
302
302
 
303
303
  if !text.include?("one|")
304
304
 
305
- matches = text.scan(/%[0-9][sdf]/)
306
-
307
- matches.each { |match|
308
- text = text.gsub(match, "%#{match[1]}$#{match[2].gsub("s","@")}")
309
- }
305
+ text = text.gsub("$s","$@").gsub("%s","%@")
310
306
 
311
307
  line = "\"#{identifier}\" = \"#{text}\";"
312
308
  if !comment.to_s.empty?
@@ -519,30 +515,40 @@ module Fastlane
519
515
  result = Array.new
520
516
  filtered = self.mapInvalidPlaceholder(text)
521
517
 
522
- stringIndexes = filtered.scan(/%[0-9]?[s@]/)
523
- intIndexes = filtered.scan(/%[0-9]?[d]/)
524
- floatIndexes = filtered.scan(/%[0-9]?[f]/)
525
- doubleIndexes = filtered.scan(/%[0-9]?ld/)
518
+ stringIndexes = self.scan_str(filtered, /%([0-9]+)?\$?[s@]/)
519
+ intIndexes = self.scan_str(filtered, /%([0-9]+)?\$?d/)
520
+ floatIndexes = self.scan_str(filtered, /%([0-9]+)?\$?([0-9]+)?.?([0-9]+)?f/)
521
+ doubleIndexes = self.scan_str(filtered, /%([0-9]+)?\$?([0-9]+)?.?([0-9]+)?ld/)
526
522
 
527
523
  if stringIndexes.count > 0
528
- result = result.concat(stringIndexes.map { |e| { "index": e, "type": "String" }})
524
+ result = result + stringIndexes.map { |e| { "index": e[0], "offset": e[1], "type": "String" }}
529
525
  end
530
526
 
531
527
  if intIndexes.count > 0
532
- result = result.concat(intIndexes.map { |e| { "index": e, "type": "Int" }})
528
+ result = result + intIndexes.map { |e| { "index": e[0], "offset": e[1], "type": "Int" }}
533
529
  end
534
530
 
535
531
  if floatIndexes.count > 0
536
- result = result.concat(floatIndexes.map { |e| { "index": e, "type": "Float" }})
532
+ result = result + floatIndexes.map { |e| { "index": e[0], "offset": e[1], "type": "Float" }}
537
533
  end
538
534
 
539
535
  if doubleIndexes.count > 0
540
- result = result.concat(doubleIndexes.map { |e| { "index": e, "type": "Double" }})
536
+ result = result + doubleIndexes.map { |e| { "index": e[0], "offset": e[1], "type": "Double" }}
541
537
  end
542
538
 
539
+ result = result.sort_by { |hsh| hsh[:offset] }
540
+
543
541
  return result
544
542
  end
545
543
 
544
+ def self.scan_str(str, pattern)
545
+ res = []
546
+ (0..str.length).each do |i|
547
+ res << [Regexp.last_match.to_s, i] if str[i..-1] =~ /^#{pattern}/
548
+ end
549
+ res
550
+ end
551
+
546
552
  def self.mapInvalidPlaceholder(text)
547
553
  filtered = text.gsub('%s', '%@').gsub('"', '\"')
548
554
  return filtered
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module GoogleSheetLocalize
3
- VERSION = "0.3.11"
3
+ VERSION = "0.4.1"
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.11
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Hahn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-24 00:00:00.000000000 Z
11
+ date: 2021-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google_drive
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 3.0.6
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 3.0.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pry
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  - !ruby/object:Gem::Version
182
182
  version: '0'
183
183
  requirements: []
184
- rubygems_version: 3.0.3
184
+ rubygems_version: 3.0.3.1
185
185
  signing_key:
186
186
  specification_version: 4
187
187
  summary: Creates .strings files for iOS and strings.xml files for Android