ad_localize 4.0.3 → 4.0.8
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 +4 -4
- data/.github/workflows/ruby.yml +12 -11
- data/CHANGELOG.md +24 -0
- data/Gemfile.lock +58 -32
- data/README.md +30 -24
- data/ad_localize.gemspec +2 -2
- data/lib/ad_localize/ad_logger.rb +1 -1
- data/lib/ad_localize/entities/key.rb +1 -1
- data/lib/ad_localize/mappers/android_translation_mapper.rb +6 -2
- data/lib/ad_localize/mappers/options_to_export_request.rb +1 -1
- 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 +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0c46c9d2fd0ef0b980ac43804c9f063d52b36be6083de7193c3e65dde9447030
|
|
4
|
+
data.tar.gz: 3a6eac4fe189d7e6de30220b410f0331d8b3a3a90a72c970a9e7ee4aa727c67c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 59fcc792844bf2558f2323f99de099709bae2145ae399231509855230268dd85756cc85145d38b5bdceb908b10635d59f6a2a7067ba32de51bae754c1e99af4a
|
|
7
|
+
data.tar.gz: 795f9239b4548412ba8f251d6328c5240d387e6089fa389e0d9c4581673dd40eb3dbc7808cc0c07b3cc8fe2c4935cc427d9c51b689bc57fb897b9b01bf8f77a6
|
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,30 @@ 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.8] - 2021-05-25
|
|
8
|
+
### Fixed
|
|
9
|
+
- Add `NFCReaderUsageDescription` to InfoPlist keys for iOS
|
|
10
|
+
|
|
11
|
+
## [4.0.7] - 2021-05-18
|
|
12
|
+
### Changed
|
|
13
|
+
- Support Ruby 3.x
|
|
14
|
+
|
|
15
|
+
## [4.0.6] - 2020-01-25
|
|
16
|
+
### Fixed
|
|
17
|
+
- Fix google spreadsheet sheet id comparison with sheet_ids option value
|
|
18
|
+
|
|
19
|
+
## [4.0.5] - 2020-11-12
|
|
20
|
+
### Fixed
|
|
21
|
+
- Fix csv file type check (also add compatibility with macOS Big Sur)
|
|
22
|
+
|
|
23
|
+
## [4.0.4] - 2020-11-09
|
|
24
|
+
### Fixed
|
|
25
|
+
- Fix android special character escaping [#56](https://github.com/applidium/ad_localize/issues/56)
|
|
26
|
+
- Fix platform filter on export [#55](https://github.com/applidium/ad_localize/issues/55)
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
- Use default terminal color for debug log
|
|
30
|
+
|
|
7
31
|
## [4.0.3] - 2020-10-27
|
|
8
32
|
### Fixed
|
|
9
33
|
- Fix CSV detection and remove dependency to MimeType gem
|
data/Gemfile.lock
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
ad_localize (4.0.
|
|
5
|
-
activesupport (>=
|
|
4
|
+
ad_localize (4.0.8)
|
|
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)
|
|
@@ -11,35 +11,57 @@ PATH
|
|
|
11
11
|
GEM
|
|
12
12
|
remote: https://rubygems.org/
|
|
13
13
|
specs:
|
|
14
|
-
activesupport (6.
|
|
14
|
+
activesupport (6.1.3.2)
|
|
15
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
16
|
-
i18n (>=
|
|
17
|
-
minitest (
|
|
18
|
-
tzinfo (~>
|
|
19
|
-
zeitwerk (~> 2.
|
|
16
|
+
i18n (>= 1.6, < 2)
|
|
17
|
+
minitest (>= 5.1)
|
|
18
|
+
tzinfo (~> 2.0)
|
|
19
|
+
zeitwerk (~> 2.3)
|
|
20
20
|
addressable (2.7.0)
|
|
21
21
|
public_suffix (>= 2.0.2, < 5.0)
|
|
22
22
|
ansi (1.5.0)
|
|
23
23
|
builder (3.2.4)
|
|
24
24
|
byebug (11.1.3)
|
|
25
25
|
colorize (0.8.1)
|
|
26
|
-
concurrent-ruby (1.1.
|
|
26
|
+
concurrent-ruby (1.1.8)
|
|
27
27
|
declarative (0.0.20)
|
|
28
|
-
declarative-option (0.1.0)
|
|
29
28
|
diffy (3.3.0)
|
|
30
|
-
faraday (1.
|
|
29
|
+
faraday (1.4.2)
|
|
30
|
+
faraday-em_http (~> 1.0)
|
|
31
|
+
faraday-em_synchrony (~> 1.0)
|
|
32
|
+
faraday-excon (~> 1.1)
|
|
33
|
+
faraday-net_http (~> 1.0)
|
|
34
|
+
faraday-net_http_persistent (~> 1.1)
|
|
31
35
|
multipart-post (>= 1.2, < 3)
|
|
32
|
-
ruby2_keywords
|
|
33
|
-
|
|
36
|
+
ruby2_keywords (>= 0.0.4)
|
|
37
|
+
faraday-em_http (1.0.0)
|
|
38
|
+
faraday-em_synchrony (1.0.0)
|
|
39
|
+
faraday-excon (1.1.0)
|
|
40
|
+
faraday-net_http (1.0.1)
|
|
41
|
+
faraday-net_http_persistent (1.1.0)
|
|
42
|
+
gems (1.2.0)
|
|
43
|
+
google-api-client (0.53.0)
|
|
44
|
+
google-apis-core (~> 0.1)
|
|
45
|
+
google-apis-generator (~> 0.1)
|
|
46
|
+
google-apis-core (0.3.0)
|
|
34
47
|
addressable (~> 2.5, >= 2.5.1)
|
|
35
|
-
googleauth (~> 0.
|
|
48
|
+
googleauth (~> 0.14)
|
|
36
49
|
httpclient (>= 2.8.1, < 3.0)
|
|
37
50
|
mini_mime (~> 1.0)
|
|
38
51
|
representable (~> 3.0)
|
|
39
52
|
retriable (>= 2.0, < 4.0)
|
|
40
53
|
rexml
|
|
41
|
-
signet (~> 0.
|
|
42
|
-
|
|
54
|
+
signet (~> 0.14)
|
|
55
|
+
webrick
|
|
56
|
+
google-apis-discovery_v1 (0.4.0)
|
|
57
|
+
google-apis-core (~> 0.1)
|
|
58
|
+
google-apis-generator (0.2.0)
|
|
59
|
+
activesupport (>= 5.0)
|
|
60
|
+
gems (~> 1.2)
|
|
61
|
+
google-apis-core (~> 0.1)
|
|
62
|
+
google-apis-discovery_v1 (~> 0.0)
|
|
63
|
+
thor (>= 0.20, < 2.a)
|
|
64
|
+
googleauth (0.16.2)
|
|
43
65
|
faraday (>= 0.17.3, < 2.0)
|
|
44
66
|
jwt (>= 1.4, < 3.0)
|
|
45
67
|
memoist (~> 0.16)
|
|
@@ -47,13 +69,13 @@ GEM
|
|
|
47
69
|
os (>= 0.9, < 2.0)
|
|
48
70
|
signet (~> 0.14)
|
|
49
71
|
httpclient (2.8.3)
|
|
50
|
-
i18n (1.8.
|
|
72
|
+
i18n (1.8.10)
|
|
51
73
|
concurrent-ruby (~> 1.0)
|
|
52
|
-
jwt (2.2.
|
|
74
|
+
jwt (2.2.3)
|
|
53
75
|
memoist (0.16.2)
|
|
54
|
-
mini_mime (1.0
|
|
55
|
-
mini_portile2 (2.
|
|
56
|
-
minitest (5.14.
|
|
76
|
+
mini_mime (1.1.0)
|
|
77
|
+
mini_portile2 (2.5.1)
|
|
78
|
+
minitest (5.14.4)
|
|
57
79
|
minitest-reporters (1.4.2)
|
|
58
80
|
ansi
|
|
59
81
|
builder
|
|
@@ -61,29 +83,33 @@ GEM
|
|
|
61
83
|
ruby-progressbar
|
|
62
84
|
multi_json (1.15.0)
|
|
63
85
|
multipart-post (2.1.1)
|
|
64
|
-
nokogiri (1.
|
|
65
|
-
mini_portile2 (~> 2.
|
|
86
|
+
nokogiri (1.11.5)
|
|
87
|
+
mini_portile2 (~> 2.5.0)
|
|
88
|
+
racc (~> 1.4)
|
|
66
89
|
os (1.1.1)
|
|
67
90
|
public_suffix (4.0.6)
|
|
91
|
+
racc (1.5.2)
|
|
68
92
|
rake (12.3.3)
|
|
69
|
-
representable (3.
|
|
93
|
+
representable (3.1.1)
|
|
70
94
|
declarative (< 0.1.0)
|
|
71
|
-
|
|
95
|
+
trailblazer-option (>= 0.1.1, < 0.2.0)
|
|
72
96
|
uber (< 0.2.0)
|
|
73
97
|
retriable (3.1.2)
|
|
74
|
-
rexml (3.2.
|
|
98
|
+
rexml (3.2.5)
|
|
75
99
|
ruby-progressbar (1.10.1)
|
|
76
|
-
ruby2_keywords (0.0.
|
|
77
|
-
signet (0.
|
|
100
|
+
ruby2_keywords (0.0.4)
|
|
101
|
+
signet (0.15.0)
|
|
78
102
|
addressable (~> 2.3)
|
|
79
103
|
faraday (>= 0.17.3, < 2.0)
|
|
80
104
|
jwt (>= 1.5, < 3.0)
|
|
81
105
|
multi_json (~> 1.10)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
106
|
+
thor (1.1.0)
|
|
107
|
+
trailblazer-option (0.1.1)
|
|
108
|
+
tzinfo (2.0.4)
|
|
109
|
+
concurrent-ruby (~> 1.0)
|
|
85
110
|
uber (0.1.0)
|
|
86
|
-
|
|
111
|
+
webrick (1.7.0)
|
|
112
|
+
zeitwerk (2.4.2)
|
|
87
113
|
|
|
88
114
|
PLATFORMS
|
|
89
115
|
ruby
|
|
@@ -98,4 +124,4 @@ DEPENDENCIES
|
|
|
98
124
|
rake (~> 12.3)
|
|
99
125
|
|
|
100
126
|
BUNDLED WITH
|
|
101
|
-
2.
|
|
127
|
+
2.2.15
|
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The purpose of this gem is to automatically generate wording files from a CSV input (CSV file or Google Spreadsheet).
|
|
4
4
|
It supports iOS, Android, JSON, YAML and Java Properties.
|
|
5
|
-
It is a useful tool when working on a mobile application or a SPA.
|
|
5
|
+
It is a useful tool when working on a mobile application or a SPA.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -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,7 +41,12 @@ $ 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
|
|
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
|
+
|
|
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
|
|
47
52
|
```
|
|
@@ -71,7 +76,7 @@ If you want more examples, please open a documentation issue.
|
|
|
71
76
|
require 'ad_localize'
|
|
72
77
|
# create optional google spreasheet options
|
|
73
78
|
g_spreadsheet_options = AdLocalize::Requests::GSpreadsheetOptions.new(spreadsheet_id: 'some_id', sheet_ids: ['first', 'second'], service_account_config: ENV['GCLOUD_CLIENT_SECRET'])
|
|
74
|
-
# create export request
|
|
79
|
+
# create export request
|
|
75
80
|
export_request = AdLocalize::Requests::ExportRequest.new(g_spreadsheet_options: g_spreadsheet_options, verbose: true)
|
|
76
81
|
# execute request
|
|
77
82
|
AdLocalize::Interactors::ExecuteExportRequest.new.call(export_request: export_request)
|
|
@@ -81,20 +86,20 @@ If you want more examples, please open a documentation issue.
|
|
|
81
86
|
### Share to anyone with the link
|
|
82
87
|
|
|
83
88
|
If you do not have high security concerns, the simplest way to access a google spreadsheet is to allow **anyone** with the link to **view** it and enable the `Viewers and commenters can see the option to download, print, and copy` option in the spreadsheet sharing settings.
|
|
84
|
-
|
|
89
|
+
|
|
85
90
|
### Use a Google Cloud Service Account
|
|
86
91
|
|
|
87
|
-
To use a private google spreasheet you need to use a Google Cloud Service Account. Here are the steps to follow :
|
|
88
|
-
1. Create a GCloud Service Account:
|
|
89
|
-
- Go to [Google Cloud Console](https://console.cloud.google.com/)
|
|
90
|
-
- Either create a new project or use an existing one (when using Firebase, a GCloud project is created)
|
|
91
|
-
- Go to *IAM & Admin / Service Account* and create a new service account.
|
|
92
|
-
- Store the created `client-secret.json` (in a password manager for example)
|
|
93
|
-
2. Enable Google Spreadsheet API for the project
|
|
94
|
-
- Go to *API / Library* and enable the **Google Spreadsheet API** there.
|
|
95
|
-
3. Add the service account to a spreadsheet.
|
|
92
|
+
To use a private google spreasheet you need to use a Google Cloud Service Account. Here are the steps to follow :
|
|
93
|
+
1. Create a GCloud Service Account:
|
|
94
|
+
- Go to [Google Cloud Console](https://console.cloud.google.com/)
|
|
95
|
+
- Either create a new project or use an existing one (when using Firebase, a GCloud project is created)
|
|
96
|
+
- Go to *IAM & Admin / Service Account* and create a new service account.
|
|
97
|
+
- Store the created `client-secret.json` (in a password manager for example)
|
|
98
|
+
2. Enable Google Spreadsheet API for the project
|
|
99
|
+
- Go to *API / Library* and enable the **Google Spreadsheet API** there.
|
|
100
|
+
3. Add the service account to a spreadsheet.
|
|
96
101
|
- In *IAM & Admin / Service Account*, the service account's email is listed. Invite it to the spreadsheet to export.
|
|
97
|
-
|
|
102
|
+
|
|
98
103
|
```
|
|
99
104
|
$ GCLOUD_CLIENT_SECRET=$(cat <path-to-client-secrets>) ad_localize -k # one way
|
|
100
105
|
$ GCLOUD_CLIENT_SECRET=$(cat <path-to-client-secrets>) ad_localize -k <your-spreadsheet-drive-key> -s <comma-separated-sheet-id-list> # another way
|
|
@@ -119,11 +124,11 @@ $ ad_localize -k <your-spreadsheet-drive-key> -s <comma-separated-sheet-id-list>
|
|
|
119
124
|
- Keys should contain only letter, number, underscore and dot : [a-z0-9_.]+.
|
|
120
125
|
- Format specifiers must be numeroted if there are more than one in a translation string (eg: `"%1$@ %2$@'s report"`).
|
|
121
126
|
|
|
122
|
-
### Comments
|
|
127
|
+
### Comments
|
|
123
128
|
|
|
124
129
|
_Only for Android and iOS_
|
|
125
130
|
|
|
126
|
-
To add comments for iOS or Android, simply add a comment column using the naming convention `comment <locale>`.
|
|
131
|
+
To add comments for iOS or Android, simply add a comment column using the naming convention `comment <locale>`.
|
|
127
132
|
Comments are available in `strings.xml`, `Localizable.strings`, `Localizable.stringsdict`, `InfoPlist.strings`. Here is an example for `InfoPlist.strings` :
|
|
128
133
|
|
|
129
134
|
| key | en | comment en |
|
|
@@ -172,21 +177,22 @@ _Only for iOS._
|
|
|
172
177
|
|
|
173
178
|
Every key that matches the following formats will be added to the `InfoPlist.strings` file instead of `Localizable.strings`:
|
|
174
179
|
* `NS...UsageDescription`
|
|
180
|
+
* `NFCReaderUsageDescription`
|
|
175
181
|
* `CF...Name`
|
|
176
182
|
|
|
177
183
|
### Nested wording
|
|
178
184
|
|
|
179
185
|
_Only for YAML and JSON_
|
|
180
186
|
|
|
181
|
-
For these two platforms it is common to have nested wording files, either to handle plural or to group wording by sections. To handle this behavior in a simple way you should use dots in the key to separate the different levels. For example :
|
|
182
|
-
|
|
187
|
+
For these two platforms it is common to have nested wording files, either to handle plural or to group wording by sections. To handle this behavior in a simple way you should use dots in the key to separate the different levels. For example :
|
|
188
|
+
|
|
183
189
|
| key | fr |
|
|
184
190
|
| --- | --- |
|
|
185
191
|
| login.password | mot de passe |
|
|
186
192
|
| login.email | email |
|
|
187
193
|
|
|
188
194
|
```json
|
|
189
|
-
{"login":{"password":"mot de passe","email":"email"}}
|
|
195
|
+
{"login":{"password":"mot de passe","email":"email"}}
|
|
190
196
|
```
|
|
191
197
|
|
|
192
198
|
```yaml
|
|
@@ -194,14 +200,14 @@ fr:
|
|
|
194
200
|
login:
|
|
195
201
|
password: "mot de passe"
|
|
196
202
|
email: "email"
|
|
197
|
-
```
|
|
203
|
+
```
|
|
198
204
|
|
|
199
205
|
|
|
200
206
|
## Output
|
|
201
207
|
|
|
202
|
-
The default output folder name is `exports`.
|
|
203
|
-
If your export is for multiple platforms there will be an intermediate folder for each platform, otherwise the wording files (and folders) will directly be generated in the export folder.
|
|
204
|
-
Any existing file will be overriden.
|
|
208
|
+
The default output folder name is `exports`.
|
|
209
|
+
If your export is for multiple platforms there will be an intermediate folder for each platform, otherwise the wording files (and folders) will directly be generated in the export folder.
|
|
210
|
+
Any existing file will be overriden.
|
|
205
211
|
You can see examples of generated files in `test/fixtures/export_references/`
|
|
206
212
|
|
|
207
213
|
Here an export tree example for all supported platforms in `fr` and `en`:
|
data/ad_localize.gemspec
CHANGED
|
@@ -46,11 +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
54
|
|
|
55
|
-
spec.required_ruby_version = '
|
|
55
|
+
spec.required_ruby_version = '>= 2.3'
|
|
56
56
|
end
|
|
@@ -4,7 +4,7 @@ module AdLocalize
|
|
|
4
4
|
PLURAL_KEY_REGEXP = /\#\#\{([A-Za-z]+)\}/.freeze
|
|
5
5
|
ADAPTIVE_KEY_REGEXP = /\#\#\{(\d+)\}/.freeze
|
|
6
6
|
# see https://developer.apple.com/documentation/bundleresources/information_property_list
|
|
7
|
-
INFO_PLIST_KEY_REGEXP = /(NS.+UsageDescription)|(CF.+Name)/.freeze
|
|
7
|
+
INFO_PLIST_KEY_REGEXP = /(NS.+UsageDescription)|(CF.+Name)|NFCReaderUsageDescription/.freeze
|
|
8
8
|
|
|
9
9
|
def initialize(label:)
|
|
10
10
|
@label = label
|
|
@@ -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'],
|
|
@@ -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
|
-
CSV_CONTENT_TYPES.include?(`file --brief --mime-type #{path}`.strip)
|
|
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.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Edouard Siegel
|
|
@@ -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'
|
|
@@ -274,7 +274,7 @@ require_paths:
|
|
|
274
274
|
- lib
|
|
275
275
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
276
276
|
requirements:
|
|
277
|
-
- - "
|
|
277
|
+
- - ">="
|
|
278
278
|
- !ruby/object:Gem::Version
|
|
279
279
|
version: '2.3'
|
|
280
280
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
@@ -283,7 +283,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
283
283
|
- !ruby/object:Gem::Version
|
|
284
284
|
version: '0'
|
|
285
285
|
requirements: []
|
|
286
|
-
rubygems_version: 3.
|
|
286
|
+
rubygems_version: 3.0.3
|
|
287
287
|
signing_key:
|
|
288
288
|
specification_version: 4
|
|
289
289
|
summary: AdLocalize helps with mobile and web applications wording
|