ad_localize 4.0.2 → 4.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +12 -11
- data/CHANGELOG.md +25 -0
- data/Gemfile.lock +54 -36
- data/README.md +6 -1
- data/ad_localize.gemspec +2 -3
- data/lib/ad_localize.rb +0 -1
- data/lib/ad_localize/ad_logger.rb +1 -1
- data/lib/ad_localize/mappers/android_translation_mapper.rb +6 -2
- data/lib/ad_localize/mappers/options_to_export_request.rb +2 -2
- data/lib/ad_localize/repositories/g_sheets_repository.rb +1 -1
- data/lib/ad_localize/requests/export_request.rb +2 -2
- data/lib/ad_localize/serializers/json_serializer.rb +1 -1
- data/lib/ad_localize/version.rb +1 -1
- metadata +8 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c430461018f65ed97a0eee0978989c7f051df7228dccede2282417cfd70b837
|
4
|
+
data.tar.gz: 38b0d8ddbd9493e3d1ba4d483bc28f943141cc7f60f4bd5d3812a5a2c715ff17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18b47316425537c6bc79f9b1db9eb828a82d380dcab2f90eb8e9ba17875e03d5cdcd4d1024f99a813090a0c477b728991fc7c94751df8bb58f3455d2d4813884
|
7
|
+
data.tar.gz: e96d73dde24bec5f84951fb880a6a1809256ab3581e51d9fc68b3e5bd9011ffb50d2173ebf5ef0ac80b8ff89387c4d2a98d6817ac799a5f58234d37948cee053
|
data/.github/workflows/ruby.yml
CHANGED
@@ -4,17 +4,18 @@ on: [push, pull_request]
|
|
4
4
|
|
5
5
|
jobs:
|
6
6
|
build:
|
7
|
-
|
8
7
|
runs-on: ubuntu-latest
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby: ['2.6.6', '2.7.3', '3.0.1']
|
9
11
|
|
10
12
|
steps:
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
bundle exec rake
|
13
|
+
- uses: actions/checkout@v2
|
14
|
+
- uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: ${{ matrix.ruby }}
|
17
|
+
- name: Build and test with Rake
|
18
|
+
run: |
|
19
|
+
gem install bundler
|
20
|
+
bundle install --jobs 4 --retry 3
|
21
|
+
bundle exec rake
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,31 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [4.0.7] - 2021-05-18
|
8
|
+
### Changed
|
9
|
+
- Support Ruby 3.x
|
10
|
+
|
11
|
+
## [4.0.6] - 2020-01-25
|
12
|
+
### Fixed
|
13
|
+
- Fix google spreadsheet sheet id comparison with sheet_ids option value
|
14
|
+
|
15
|
+
## [4.0.5] - 2020-11-12
|
16
|
+
### Fixed
|
17
|
+
- Fix csv file type check (also add compatibility with macOS Big Sur)
|
18
|
+
|
19
|
+
## [4.0.4] - 2020-11-09
|
20
|
+
### Fixed
|
21
|
+
- Fix android special character escaping [#56](https://github.com/applidium/ad_localize/issues/56)
|
22
|
+
- Fix platform filter on export [#55](https://github.com/applidium/ad_localize/issues/55)
|
23
|
+
|
24
|
+
### Changed
|
25
|
+
- Use default terminal color for debug log
|
26
|
+
|
27
|
+
## [4.0.3] - 2020-10-27
|
28
|
+
### Fixed
|
29
|
+
- Fix CSV detection and remove dependency to MimeType gem
|
30
|
+
- Fix drive key detection in options
|
31
|
+
|
7
32
|
## [4.0.2] - 2020-10-26
|
8
33
|
### Fixed
|
9
34
|
- Use percent HTML char for escaping '%' on android. [#49](https://github.com/applidium/ad_localize/pull/49) by [flolom](https://github.com/flolom)
|
data/Gemfile.lock
CHANGED
@@ -1,46 +1,63 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ad_localize (4.0.
|
5
|
-
activesupport (>=
|
4
|
+
ad_localize (4.0.7)
|
5
|
+
activesupport (>= 6.1.3.2, < 7.0)
|
6
6
|
colorize (~> 0.8)
|
7
7
|
google-api-client (~> 0.34)
|
8
8
|
googleauth (~> 0.12)
|
9
|
-
mime-types (~> 3.3)
|
10
9
|
nokogiri (~> 1.10)
|
11
10
|
|
12
11
|
GEM
|
13
12
|
remote: https://rubygems.org/
|
14
13
|
specs:
|
15
|
-
activesupport (6.
|
14
|
+
activesupport (6.1.3.2)
|
16
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
-
i18n (>=
|
18
|
-
minitest (
|
19
|
-
tzinfo (~>
|
20
|
-
zeitwerk (~> 2.
|
16
|
+
i18n (>= 1.6, < 2)
|
17
|
+
minitest (>= 5.1)
|
18
|
+
tzinfo (~> 2.0)
|
19
|
+
zeitwerk (~> 2.3)
|
21
20
|
addressable (2.7.0)
|
22
21
|
public_suffix (>= 2.0.2, < 5.0)
|
23
22
|
ansi (1.5.0)
|
24
23
|
builder (3.2.4)
|
25
24
|
byebug (11.1.3)
|
26
25
|
colorize (0.8.1)
|
27
|
-
concurrent-ruby (1.1.
|
26
|
+
concurrent-ruby (1.1.8)
|
28
27
|
declarative (0.0.20)
|
29
|
-
declarative-option (0.1.0)
|
30
28
|
diffy (3.3.0)
|
31
|
-
faraday (1.1
|
29
|
+
faraday (1.4.1)
|
30
|
+
faraday-excon (~> 1.1)
|
31
|
+
faraday-net_http (~> 1.0)
|
32
|
+
faraday-net_http_persistent (~> 1.1)
|
32
33
|
multipart-post (>= 1.2, < 3)
|
33
|
-
ruby2_keywords
|
34
|
-
|
34
|
+
ruby2_keywords (>= 0.0.4)
|
35
|
+
faraday-excon (1.1.0)
|
36
|
+
faraday-net_http (1.0.1)
|
37
|
+
faraday-net_http_persistent (1.1.0)
|
38
|
+
gems (1.2.0)
|
39
|
+
google-api-client (0.53.0)
|
40
|
+
google-apis-core (~> 0.1)
|
41
|
+
google-apis-generator (~> 0.1)
|
42
|
+
google-apis-core (0.3.0)
|
35
43
|
addressable (~> 2.5, >= 2.5.1)
|
36
|
-
googleauth (~> 0.
|
44
|
+
googleauth (~> 0.14)
|
37
45
|
httpclient (>= 2.8.1, < 3.0)
|
38
46
|
mini_mime (~> 1.0)
|
39
47
|
representable (~> 3.0)
|
40
48
|
retriable (>= 2.0, < 4.0)
|
41
49
|
rexml
|
42
|
-
signet (~> 0.
|
43
|
-
|
50
|
+
signet (~> 0.14)
|
51
|
+
webrick
|
52
|
+
google-apis-discovery_v1 (0.2.0)
|
53
|
+
google-apis-core (~> 0.1)
|
54
|
+
google-apis-generator (0.2.0)
|
55
|
+
activesupport (>= 5.0)
|
56
|
+
gems (~> 1.2)
|
57
|
+
google-apis-core (~> 0.1)
|
58
|
+
google-apis-discovery_v1 (~> 0.0)
|
59
|
+
thor (>= 0.20, < 2.a)
|
60
|
+
googleauth (0.16.2)
|
44
61
|
faraday (>= 0.17.3, < 2.0)
|
45
62
|
jwt (>= 1.4, < 3.0)
|
46
63
|
memoist (~> 0.16)
|
@@ -48,16 +65,13 @@ GEM
|
|
48
65
|
os (>= 0.9, < 2.0)
|
49
66
|
signet (~> 0.14)
|
50
67
|
httpclient (2.8.3)
|
51
|
-
i18n (1.8.
|
68
|
+
i18n (1.8.10)
|
52
69
|
concurrent-ruby (~> 1.0)
|
53
|
-
jwt (2.2.
|
70
|
+
jwt (2.2.3)
|
54
71
|
memoist (0.16.2)
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
mini_mime (1.0.2)
|
59
|
-
mini_portile2 (2.4.0)
|
60
|
-
minitest (5.14.0)
|
72
|
+
mini_mime (1.1.0)
|
73
|
+
mini_portile2 (2.5.1)
|
74
|
+
minitest (5.14.4)
|
61
75
|
minitest-reporters (1.4.2)
|
62
76
|
ansi
|
63
77
|
builder
|
@@ -65,29 +79,33 @@ GEM
|
|
65
79
|
ruby-progressbar
|
66
80
|
multi_json (1.15.0)
|
67
81
|
multipart-post (2.1.1)
|
68
|
-
nokogiri (1.
|
69
|
-
mini_portile2 (~> 2.
|
82
|
+
nokogiri (1.11.4)
|
83
|
+
mini_portile2 (~> 2.5.0)
|
84
|
+
racc (~> 1.4)
|
70
85
|
os (1.1.1)
|
71
86
|
public_suffix (4.0.6)
|
87
|
+
racc (1.5.2)
|
72
88
|
rake (12.3.3)
|
73
|
-
representable (3.
|
89
|
+
representable (3.1.1)
|
74
90
|
declarative (< 0.1.0)
|
75
|
-
|
91
|
+
trailblazer-option (>= 0.1.1, < 0.2.0)
|
76
92
|
uber (< 0.2.0)
|
77
93
|
retriable (3.1.2)
|
78
|
-
rexml (3.2.
|
94
|
+
rexml (3.2.5)
|
79
95
|
ruby-progressbar (1.10.1)
|
80
|
-
ruby2_keywords (0.0.
|
81
|
-
signet (0.
|
96
|
+
ruby2_keywords (0.0.4)
|
97
|
+
signet (0.15.0)
|
82
98
|
addressable (~> 2.3)
|
83
99
|
faraday (>= 0.17.3, < 2.0)
|
84
100
|
jwt (>= 1.5, < 3.0)
|
85
101
|
multi_json (~> 1.10)
|
86
|
-
|
87
|
-
|
88
|
-
|
102
|
+
thor (1.1.0)
|
103
|
+
trailblazer-option (0.1.1)
|
104
|
+
tzinfo (2.0.4)
|
105
|
+
concurrent-ruby (~> 1.0)
|
89
106
|
uber (0.1.0)
|
90
|
-
|
107
|
+
webrick (1.7.0)
|
108
|
+
zeitwerk (2.4.2)
|
91
109
|
|
92
110
|
PLATFORMS
|
93
111
|
ruby
|
@@ -102,4 +120,4 @@ DEPENDENCIES
|
|
102
120
|
rake (~> 12.3)
|
103
121
|
|
104
122
|
BUNDLED WITH
|
105
|
-
2.
|
123
|
+
2.2.15
|
data/README.md
CHANGED
@@ -31,7 +31,7 @@ $ gem install ad_localize
|
|
31
31
|
$ ad_localize -h
|
32
32
|
```
|
33
33
|
|
34
|
-
* Export wording from a google spreadsheet, default tab. The spreadsheet key and sheet_id are available in the spreadsheet url. For example `https://docs.google.com/spreadsheets/d/<your-spreadsheet-drive-key>/edit#gid=<sheet-id>`.
|
34
|
+
* Export wording from a public google spreadsheet, default tab. The spreadsheet key and sheet_id are available in the spreadsheet url. For example `https://docs.google.com/spreadsheets/d/<your-spreadsheet-drive-key>/edit#gid=<sheet-id>`.
|
35
35
|
```
|
36
36
|
$ ad_localize -k <your-spreadsheet-drive-key>
|
37
37
|
```
|
@@ -41,6 +41,11 @@ $ ad_localize -k <your-spreadsheet-drive-key>
|
|
41
41
|
$ ad_localize -k <your-spreadsheet-drive-key> -s <comma-separated-sheet-id-list>
|
42
42
|
```
|
43
43
|
|
44
|
+
* Export wording from a private google spreadsheet. It requires a [Google Cloud Service Account](#using-a-google-cloud-service-account).
|
45
|
+
```
|
46
|
+
$ GCLOUD_CLIENT_SECRET=$(cat <path-to-client-secret.json>) ad_localize -k <your-spreadsheet-drive-key>
|
47
|
+
```
|
48
|
+
|
44
49
|
* Export wording from all sheets in a google spreadsheet. It requires a [Google Cloud Service Account](#using-a-google-cloud-service-account).
|
45
50
|
```
|
46
51
|
$ GCLOUD_CLIENT_SECRET=$(cat <path-to-client-secret.json>) ad_localize -k <your-spreadsheet-drive-key> -e
|
data/ad_localize.gemspec
CHANGED
@@ -46,12 +46,11 @@ Gem::Specification.new do |spec|
|
|
46
46
|
spec.add_development_dependency 'minitest-reporters', '~> 1.3'
|
47
47
|
spec.add_development_dependency 'diffy', '~> 3.3'
|
48
48
|
|
49
|
-
spec.add_dependency 'activesupport', '>=
|
49
|
+
spec.add_dependency 'activesupport', '>= 6.1.3.2', '< 7.0'
|
50
50
|
spec.add_dependency 'nokogiri', '~> 1.10'
|
51
51
|
spec.add_dependency 'colorize', '~> 0.8'
|
52
52
|
spec.add_dependency 'google-api-client', '~> 0.34'
|
53
53
|
spec.add_dependency 'googleauth', '~> 0.12'
|
54
|
-
spec.add_dependency 'mime-types', '~> 3.3'
|
55
54
|
|
56
|
-
spec.required_ruby_version = '
|
55
|
+
spec.required_ruby_version = '>= 2.3'
|
57
56
|
end
|
data/lib/ad_localize.rb
CHANGED
@@ -5,12 +5,16 @@ module AdLocalize
|
|
5
5
|
|
6
6
|
def sanitize_value(value:)
|
7
7
|
return if value.blank?
|
8
|
-
processedValue = value.gsub(/(?<!\\)'/,
|
9
|
-
processedValue = processedValue.gsub(/(?<!\\)\"/,
|
8
|
+
processedValue = value.gsub(/(?<!\\)'/, ''') # match ' unless there is a \ before
|
9
|
+
processedValue = processedValue.gsub(/(?<!\\)\"/, '"') # match " unless there is a \ before
|
10
|
+
processedValue = processedValue.gsub(">", '>')
|
11
|
+
processedValue = processedValue.gsub("<", '<')
|
10
12
|
processedValue = processedValue.gsub(/(%(\d+\$)?@)/, '%\2s') # should match values like %1$s and %s
|
11
13
|
processedValue = processedValue.gsub(/(%((\d+\$)?(\d+)?)i)/, '%\2d') # should match values like %i, %3$i, %01i, %1$02i
|
12
14
|
processedValue = processedValue.gsub(/%(?!((\d+\$)?(s|(\d+)?d)))/, '%') # negative lookahead: identifies when user really wants to display a %
|
13
15
|
processedValue = processedValue.gsub("\\U", "\\u")
|
16
|
+
processedValue = processedValue.gsub(/&(?!((#\d+)|(\w+));)/, '&')
|
17
|
+
processedValue = processedValue.gsub(/&/) { |match| match.replace('\&') }
|
14
18
|
"\"#{processedValue}\""
|
15
19
|
end
|
16
20
|
end
|
@@ -3,7 +3,7 @@ module AdLocalize
|
|
3
3
|
class OptionsToExportRequest
|
4
4
|
def map(options:)
|
5
5
|
Requests::ExportRequest.new(
|
6
|
-
|
6
|
+
platforms: options[:only],
|
7
7
|
g_spreadsheet_options: map_g_spreadsheet_options(options: options),
|
8
8
|
verbose: options[:debug],
|
9
9
|
output_path: options[:'target-dir'],
|
@@ -15,7 +15,7 @@ module AdLocalize
|
|
15
15
|
private
|
16
16
|
|
17
17
|
def map_g_spreadsheet_options(options:)
|
18
|
-
return unless options[:
|
18
|
+
return unless options[:'drive-key']
|
19
19
|
Requests::GSpreadsheetOptions.new(
|
20
20
|
spreadsheet_id: options[:'drive-key'],
|
21
21
|
sheet_ids: options[:'sheets'],
|
@@ -19,7 +19,7 @@ module AdLocalize
|
|
19
19
|
spreadsheet.sheets[0..0].map { |sheet| get_sheet_values(spreadsheet_id: g_spreadsheet_options.spreadsheet_id, sheet: sheet) }
|
20
20
|
else
|
21
21
|
spreadsheet.sheets.select do |sheet|
|
22
|
-
g_spreadsheet_options.sheet_ids.include?(sheet.properties.sheet_id)
|
22
|
+
g_spreadsheet_options.sheet_ids.include?(sheet.properties.sheet_id.to_s)
|
23
23
|
end.map do |sheet|
|
24
24
|
get_sheet_values(spreadsheet_id: g_spreadsheet_options.spreadsheet_id, sheet: sheet)
|
25
25
|
end
|
@@ -3,7 +3,7 @@ module AdLocalize
|
|
3
3
|
class ExportRequest
|
4
4
|
SUPPORTED_PLATFORMS = %w(ios android yml json properties).freeze
|
5
5
|
DEFAULT_EXPORT_FOLDER = 'exports'.freeze
|
6
|
-
CSV_CONTENT_TYPES = %w(text/csv text/plain).freeze
|
6
|
+
CSV_CONTENT_TYPES = %w(text/csv text/plain application/csv).freeze
|
7
7
|
|
8
8
|
def initialize(**args)
|
9
9
|
@locales = Array(args[:locales].presence)
|
@@ -61,7 +61,7 @@ module AdLocalize
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def is_csv?(path:)
|
64
|
-
|
64
|
+
CSV_CONTENT_TYPES.include?(`file --brief --mime-type "#{path}"`.strip)
|
65
65
|
end
|
66
66
|
|
67
67
|
def valid_g_spreadsheet_options?
|
data/lib/ad_localize/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ad_localize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edouard Siegel
|
@@ -17,7 +17,7 @@ authors:
|
|
17
17
|
- Claire Dufetrelle
|
18
18
|
- Pierre Felgines
|
19
19
|
- Satyan Jacquens
|
20
|
-
autorequire:
|
20
|
+
autorequire:
|
21
21
|
bindir: exe
|
22
22
|
cert_chain: []
|
23
23
|
date: 2018-04-18 00:00:00.000000000 Z
|
@@ -118,7 +118,7 @@ dependencies:
|
|
118
118
|
requirements:
|
119
119
|
- - ">="
|
120
120
|
- !ruby/object:Gem::Version
|
121
|
-
version:
|
121
|
+
version: 6.1.3.2
|
122
122
|
- - "<"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '7.0'
|
@@ -128,7 +128,7 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 6.1.3.2
|
132
132
|
- - "<"
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: '7.0'
|
@@ -188,20 +188,6 @@ dependencies:
|
|
188
188
|
- - "~>"
|
189
189
|
- !ruby/object:Gem::Version
|
190
190
|
version: '0.12'
|
191
|
-
- !ruby/object:Gem::Dependency
|
192
|
-
name: mime-types
|
193
|
-
requirement: !ruby/object:Gem::Requirement
|
194
|
-
requirements:
|
195
|
-
- - "~>"
|
196
|
-
- !ruby/object:Gem::Version
|
197
|
-
version: '3.3'
|
198
|
-
type: :runtime
|
199
|
-
prerelease: false
|
200
|
-
version_requirements: !ruby/object:Gem::Requirement
|
201
|
-
requirements:
|
202
|
-
- - "~>"
|
203
|
-
- !ruby/object:Gem::Version
|
204
|
-
version: '3.3'
|
205
191
|
description: |-
|
206
192
|
AdLocalize produces localization files from platform agnostic wording.
|
207
193
|
Supported wording format : CSV. Supported export format: iOS, Android, JSON and YAML
|
@@ -282,13 +268,13 @@ homepage: https://github.com/applidium/ad_localize
|
|
282
268
|
licenses:
|
283
269
|
- MIT
|
284
270
|
metadata: {}
|
285
|
-
post_install_message:
|
271
|
+
post_install_message:
|
286
272
|
rdoc_options: []
|
287
273
|
require_paths:
|
288
274
|
- lib
|
289
275
|
required_ruby_version: !ruby/object:Gem::Requirement
|
290
276
|
requirements:
|
291
|
-
- - "
|
277
|
+
- - ">="
|
292
278
|
- !ruby/object:Gem::Version
|
293
279
|
version: '2.3'
|
294
280
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -297,8 +283,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
297
283
|
- !ruby/object:Gem::Version
|
298
284
|
version: '0'
|
299
285
|
requirements: []
|
300
|
-
rubygems_version: 3.
|
301
|
-
signing_key:
|
286
|
+
rubygems_version: 3.2.15
|
287
|
+
signing_key:
|
302
288
|
specification_version: 4
|
303
289
|
summary: AdLocalize helps with mobile and web applications wording
|
304
290
|
test_files: []
|