ad_localize 4.0.1 → 4.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -6
- data/Gemfile.lock +13 -11
- data/README.md +6 -1
- data/ad_localize.gemspec +0 -1
- 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 +7 -3
- 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/version.rb +1 -1
- metadata +1 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dc831e39e21e628ccb906bb9c1b6c3d413e6c182384b6e679a7586e0826d93a
|
4
|
+
data.tar.gz: 0e3a03ab471b2a45e1b23b44a67d196bf609503ff51364b81fe886b03fc895ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 571e52661789dd15c8a24958a2a2cae26a166e4081b7739ee09fb5df6993ec9658c26e3df3aebcdf458d9980ebb4e2a32bb1eefca294daa2c3abe1396d1faf6f
|
7
|
+
data.tar.gz: e66e4710b854bf15e161e6149f2f2d20e9ff54cc0ddcc0207d2bc421dd935a35dbd419069b37e9b9fd3f3549222637a0262f24c2f486e83673589eaf9f3fdae1
|
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.5] - 2020-01-25
|
8
|
+
### Fixed
|
9
|
+
- Fix google spreadsheet sheet id comparison with sheet_ids option value
|
10
|
+
|
11
|
+
## [4.0.5] - 2020-11-12
|
12
|
+
### Fixed
|
13
|
+
- Fix csv file type check (also add compatibility with macOS Big Sur)
|
14
|
+
|
15
|
+
## [4.0.4] - 2020-11-09
|
16
|
+
### Fixed
|
17
|
+
- Fix android special character escaping [#56](https://github.com/applidium/ad_localize/issues/56)
|
18
|
+
- Fix platform filter on export [#55](https://github.com/applidium/ad_localize/issues/55)
|
19
|
+
|
20
|
+
### Changed
|
21
|
+
- Use default terminal color for debug log
|
22
|
+
|
23
|
+
## [4.0.3] - 2020-10-27
|
24
|
+
### Fixed
|
25
|
+
- Fix CSV detection and remove dependency to MimeType gem
|
26
|
+
- Fix drive key detection in options
|
27
|
+
|
28
|
+
## [4.0.2] - 2020-10-26
|
29
|
+
### Fixed
|
30
|
+
- Use percent HTML char for escaping '%' on android. [#49](https://github.com/applidium/ad_localize/pull/49) by [flolom](https://github.com/flolom)
|
31
|
+
|
7
32
|
## [4.0.1] - 2020-10-19
|
8
33
|
### Fixed
|
9
34
|
- delete downloaded files even when any of them is a CSV file
|
@@ -13,7 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
13
38
|
- Precedence to csv files. Only CSV files will be exported if both csv file and google spreadsheet are provided
|
14
39
|
- In case of multiple CSVs or sheet ids, you should be aware that all sources will be merged. By default the merge policy to keep the first wording translation for each key
|
15
40
|
- New architecture. Separate export process responsibilities in dedicated classes. Fixes [#48](https://github.com/applidium/ad_localize/issues/48), [#20](https://github.com/applidium/ad_localize/issues/20)
|
16
|
-
|
41
|
+
|
17
42
|
### Changed
|
18
43
|
- it is now possible to provide an output path path that does not exist
|
19
44
|
- if a service account configuration is provided, there won't be any files downloaded
|
@@ -24,8 +49,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
24
49
|
- tests for ad_localize class are restricted to the minimum
|
25
50
|
- No more file generated when there are no data to export
|
26
51
|
- Less verbose logs. Now, they only describe the different steps of the export process
|
27
|
-
- do not add `InfoPlist` translations to android `strings.xml`
|
28
|
-
|
52
|
+
- do not add `InfoPlist` translations to android `strings.xml`
|
53
|
+
|
29
54
|
### Added
|
30
55
|
- -e, -export_all_sheets option export all sheets from a spreadsheet by [@sjcqs](https://github.com/sjcqs)
|
31
56
|
- -m, --merge-option to select the merge policy (`keep` or `replace`) by [@sjcqs](https://github.com/sjcqs)
|
@@ -37,7 +62,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
37
62
|
- dedicated folder for fixture files
|
38
63
|
- add ability to use AdLocalize in a Ruby program
|
39
64
|
- add documentation for JSON and YAML support. Fixes [#23](https://github.com/applidium/ad_localize/issues/23)
|
40
|
-
|
65
|
+
|
41
66
|
### Fixed
|
42
67
|
- comments will now be added to iOS and Android plural files
|
43
68
|
- do not remove existing files in export output folder. Fixes [#40](https://github.com/applidium/ad_localize/issues/40)
|
@@ -46,8 +71,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
46
71
|
- no more option -a option to indicate that a service account configuration will be provided. If set, the environment variable `GCLOUD_CLIENT_SECRET` content will be used
|
47
72
|
- no more substitution of empty wording with by "Missing Translation" when using the option -d
|
48
73
|
- no more Makefile, the Rakefile is sufficient. Use `bundle exec rake -T` to display the available commands
|
49
|
-
- no more check for ordered interpolation variables in translations
|
50
|
-
|
74
|
+
- no more check for ordered interpolation variables in translations
|
75
|
+
|
51
76
|
## [3.6.0] - 2020-06-23
|
52
77
|
### Added
|
53
78
|
- add documentation for service account usage by [@sjcqs](https://github.com/sjcqs)
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ad_localize (4.0.
|
4
|
+
ad_localize (4.0.6)
|
5
5
|
activesupport (>= 5.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
|
@@ -28,17 +27,19 @@ GEM
|
|
28
27
|
declarative (0.0.20)
|
29
28
|
declarative-option (0.1.0)
|
30
29
|
diffy (3.3.0)
|
31
|
-
faraday (1.0
|
30
|
+
faraday (1.1.0)
|
32
31
|
multipart-post (>= 1.2, < 3)
|
33
|
-
|
32
|
+
ruby2_keywords
|
33
|
+
google-api-client (0.46.2)
|
34
34
|
addressable (~> 2.5, >= 2.5.1)
|
35
35
|
googleauth (~> 0.9)
|
36
36
|
httpclient (>= 2.8.1, < 3.0)
|
37
37
|
mini_mime (~> 1.0)
|
38
38
|
representable (~> 3.0)
|
39
39
|
retriable (>= 2.0, < 4.0)
|
40
|
+
rexml
|
40
41
|
signet (~> 0.12)
|
41
|
-
googleauth (0.
|
42
|
+
googleauth (0.14.0)
|
42
43
|
faraday (>= 0.17.3, < 2.0)
|
43
44
|
jwt (>= 1.4, < 3.0)
|
44
45
|
memoist (~> 0.16)
|
@@ -50,11 +51,8 @@ GEM
|
|
50
51
|
concurrent-ruby (~> 1.0)
|
51
52
|
jwt (2.2.2)
|
52
53
|
memoist (0.16.2)
|
53
|
-
mime-types (3.3.1)
|
54
|
-
mime-types-data (~> 3.2015)
|
55
|
-
mime-types-data (3.2020.0512)
|
56
54
|
mini_mime (1.0.2)
|
57
|
-
mini_portile2 (2.
|
55
|
+
mini_portile2 (2.5.0)
|
58
56
|
minitest (5.14.0)
|
59
57
|
minitest-reporters (1.4.2)
|
60
58
|
ansi
|
@@ -63,17 +61,21 @@ GEM
|
|
63
61
|
ruby-progressbar
|
64
62
|
multi_json (1.15.0)
|
65
63
|
multipart-post (2.1.1)
|
66
|
-
nokogiri (1.
|
67
|
-
mini_portile2 (~> 2.
|
64
|
+
nokogiri (1.11.1)
|
65
|
+
mini_portile2 (~> 2.5.0)
|
66
|
+
racc (~> 1.4)
|
68
67
|
os (1.1.1)
|
69
68
|
public_suffix (4.0.6)
|
69
|
+
racc (1.5.2)
|
70
70
|
rake (12.3.3)
|
71
71
|
representable (3.0.4)
|
72
72
|
declarative (< 0.1.0)
|
73
73
|
declarative-option (< 0.2.0)
|
74
74
|
uber (< 0.2.0)
|
75
75
|
retriable (3.1.2)
|
76
|
+
rexml (3.2.4)
|
76
77
|
ruby-progressbar (1.10.1)
|
78
|
+
ruby2_keywords (0.0.2)
|
77
79
|
signet (0.14.0)
|
78
80
|
addressable (~> 2.3)
|
79
81
|
faraday (>= 0.17.3, < 2.0)
|
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
@@ -51,7 +51,6 @@ Gem::Specification.new do |spec|
|
|
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
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
|
-
processedValue = processedValue.gsub(/%(?!((\d+\$)?(s|(\d+)?d)))/, '
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edouard Siegel
|
@@ -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
|