ad_localize 4.0.9 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -1
  3. data/CHANGELOG.md +58 -15
  4. data/Gemfile.lock +32 -32
  5. data/README.md +6 -0
  6. data/ad_localize.gemspec +6 -6
  7. data/bin/console +0 -1
  8. data/lib/ad_localize/entities/translation.rb +4 -0
  9. data/lib/ad_localize/interactors/execute_export_request.rb +2 -0
  10. data/lib/ad_localize/interactors/export_csv_files.rb +6 -3
  11. data/lib/ad_localize/interactors/export_g_spreadsheet.rb +9 -4
  12. data/lib/ad_localize/interactors/export_wording.rb +15 -12
  13. data/lib/ad_localize/interactors/platforms/export_android_locale_wording.rb +16 -15
  14. data/lib/ad_localize/interactors/platforms/export_csv_locale_wording.rb +5 -8
  15. data/lib/ad_localize/interactors/platforms/export_ios_locale_wording.rb +28 -19
  16. data/lib/ad_localize/interactors/platforms/export_json_locale_wording.rb +11 -11
  17. data/lib/ad_localize/interactors/platforms/export_properties_locale_wording.rb +11 -12
  18. data/lib/ad_localize/interactors/platforms/export_yaml_locale_wording.rb +11 -11
  19. data/lib/ad_localize/mappers/android_translation_mapper.rb +9 -1
  20. data/lib/ad_localize/mappers/options_to_export_request.rb +1 -0
  21. data/lib/ad_localize/option_handler.rb +1 -0
  22. data/lib/ad_localize/requests/export_request.rb +6 -0
  23. data/lib/ad_localize/requests/export_wording_options.rb +24 -0
  24. data/lib/ad_localize/serializers/localizable_strings_serializer.rb +5 -1
  25. data/lib/ad_localize/serializers/localizable_stringsdict_serializer.rb +8 -2
  26. data/lib/ad_localize/serializers/strings_serializer.rb +4 -2
  27. data/lib/ad_localize/version.rb +1 -1
  28. data/lib/ad_localize/view_models/translation_group_view_model.rb +4 -0
  29. data/lib/ad_localize/view_models/translation_view_model.rb +4 -0
  30. data/lib/ad_localize.rb +1 -0
  31. metadata +21 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e17293e2000accb75875be47bacc58bf7193039c4f0f2a407c5787fbcde38d6
4
- data.tar.gz: e0b68dcc055d3e303878496953411b96926f774fbd28805ec9684d4022a54c2a
3
+ metadata.gz: e367d46040937d12da9dabf34045b83a66a3e3a042833f96971c84621f326ff7
4
+ data.tar.gz: d6939a29627f1c1681525c5618dd2f68e78132de0d75d3208ad53c8495c346d3
5
5
  SHA512:
6
- metadata.gz: e81296d0f5bb5bbe41d1fedddf36814a0ee695919bf8f00f527ecdf02a830e6f1ccb5c3a4c4542c47345d552cac0d229f4dbb41797e1bdd66d89dbd7d6b812d1
7
- data.tar.gz: 7a963846243a0fd6026bb3f9e604ea946937cace3f6d66d8e22a4a698d0aa3c2f4fe1b98a60620f1d21cbd179f75e153e216b2736827b7c5b8409b9ef25e94a8
6
+ metadata.gz: d05c3855c3a3b1de045b7f808d8e7e1898ba6f1a65e27cb9cd1788578ae4c448abb6960b450a09c43416b8744c6ec8857b936889111ca10553daf17771b40692
7
+ data.tar.gz: c52f9eee3bab2dd91b8786ff6eb848c9da3b3ef3e0a9a3bccf0445783118432be8538ac3a12ef6639831ab920df37b98c7e8cbee0cbdf595a4e475e419a70261
@@ -7,7 +7,7 @@ jobs:
7
7
  runs-on: ubuntu-latest
8
8
  strategy:
9
9
  matrix:
10
- ruby: ['2.6.6', '2.7.3', '3.0.1']
10
+ ruby: ['2.7.3', '3.0.1', '3.1.0']
11
11
 
12
12
  steps:
13
13
  - uses: actions/checkout@v2
data/CHANGELOG.md CHANGED
@@ -5,14 +5,43 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## Unreleased
9
+
10
+ ## [5.0.0] - 2022-07-26
11
+
12
+ ### Added
13
+
14
+ - Added new option (-x) to bypass keys with empty values for iOS only in
15
+ PR [#78](https://github.com/faberNovel/ad_localize/pull/78) by [ThomasEsterlin](https://github.com/ThomasEsterlin)
16
+
17
+ ### Breaking change
18
+
19
+ - Drop support for Ruby >= 2.3, < 2.7
20
+
21
+ ## [4.1.1] - 2022-04-15
22
+
23
+ ### Fixed
24
+
25
+ - Fix an issue with percent export in PR [#74](https://github.com/faberNovel/ad_localize/pull/74)
26
+
27
+ ## [4.1.0] - 2022-03-02
28
+
29
+ ### Changed
30
+
31
+ - Do not export empty translation on Android in PR [#72](https://github.com/faberNovel/ad_localize/pull/72)
32
+
8
33
  ## [4.0.9] - 2021-09-05
9
34
 
10
35
  ### Fixed
11
36
 
12
- - Fix error warning when spreadsheet is empty. Fix [#58](https://github.com/applidium/ad_localize/issues/58) in PR [#69](https://github.com/applidium/ad_localize/pull/69)
13
- - Add warning messages when input is corrupted. Fix [#59](https://github.com/applidium/ad_localize/issues/59) in PR [#69](https://github.com/applidium/ad_localize/pull/69)
14
- - Fix performance issue and add warning messages. Fix [#61](https://github.com/applidium/ad_localize/issues/61) in PR [#69](https://github.com/applidium/ad_localize/pull/69)
15
- - Update deprecated `google-api-client` gem. Fix [#63](https://github.com/applidium/ad_localize/issues/63) in PR [#70](https://github.com/applidium/ad_localize/pull/70)
37
+ - Fix error warning when spreadsheet is empty. Fix [#58](https://github.com/applidium/ad_localize/issues/58) in
38
+ PR [#69](https://github.com/applidium/ad_localize/pull/69)
39
+ - Add warning messages when input is corrupted. Fix [#59](https://github.com/applidium/ad_localize/issues/59) in
40
+ PR [#69](https://github.com/applidium/ad_localize/pull/69)
41
+ - Fix performance issue and add warning messages. Fix [#61](https://github.com/applidium/ad_localize/issues/61) in
42
+ PR [#69](https://github.com/applidium/ad_localize/pull/69)
43
+ - Update deprecated `google-api-client` gem. Fix [#63](https://github.com/applidium/ad_localize/issues/63) in
44
+ PR [#70](https://github.com/applidium/ad_localize/pull/70)
16
45
 
17
46
  ## [4.0.8] - 2021-05-25
18
47
 
@@ -60,7 +89,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
60
89
 
61
90
  ### Fixed
62
91
 
63
- - Use percent HTML char for escaping '%' on android. [#49](https://github.com/applidium/ad_localize/pull/49) by [flolom](https://github.com/flolom)
92
+ - Use percent HTML char for escaping '%' on android. [#49](https://github.com/applidium/ad_localize/pull/49)
93
+ by [flolom](https://github.com/flolom)
64
94
 
65
95
  ## [4.0.1] - 2020-10-19
66
96
 
@@ -73,8 +103,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
73
103
  ### Breaking change
74
104
 
75
105
  - Precedence to csv files. Only CSV files will be exported if both csv file and google spreadsheet are provided
76
- - 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
77
- - 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)
106
+ - In case of multiple CSVs or sheet ids, you should be aware that all sources will be merged. By default the merge
107
+ policy to keep the first wording translation for each key
108
+ - New architecture. Separate export process responsibilities in dedicated classes.
109
+ Fixes [#48](https://github.com/applidium/ad_localize/issues/48)
110
+ , [#20](https://github.com/applidium/ad_localize/issues/20)
78
111
 
79
112
  ### Changed
80
113
 
@@ -109,7 +142,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
109
142
 
110
143
  ### Removed
111
144
 
112
- - 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
145
+ - no more option -a option to indicate that a service account configuration will be provided. If set, the environment
146
+ variable `GCLOUD_CLIENT_SECRET` content will be used
113
147
  - no more substitution of empty wording with by "Missing Translation" when using the option -d
114
148
  - no more Makefile, the Rakefile is sufficient. Use `bundle exec rake -T` to display the available commands
115
149
  - no more check for ordered interpolation variables in translations
@@ -129,25 +163,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
129
163
 
130
164
  ### Added
131
165
 
132
- - add support for private spreadsheet using google service acccount by [@sjcqs](https://github.com/sjcqs). Fixes [#31](https://github.com/applidium/ad_localize/issues/31)
166
+ - add support for private spreadsheet using google service acccount by [@sjcqs](https://github.com/sjcqs).
167
+ Fixes [#31](https://github.com/applidium/ad_localize/issues/31)
133
168
  - add makefile for easier testing by [@felginep](https://github.com/felginep)
134
169
 
135
170
  ### Changed
136
171
 
137
- - improve error message to have useful information in case of google spreadsheet use by [@felginep](https://github.com/felginep). Fixes [#27](https://github.com/applidium/ad_localize/issues/27)
138
- - platform folder is no longer generated when there is only one platform selected. The files are directly generated in the output path. By [@felginep](https://github.com/felginep). Fixes [#29](https://github.com/applidium/ad_localize/issues/29)
172
+ - improve error message to have useful information in case of google spreadsheet use
173
+ by [@felginep](https://github.com/felginep). Fixes [#27](https://github.com/applidium/ad_localize/issues/27)
174
+ - platform folder is no longer generated when there is only one platform selected. The files are directly generated in
175
+ the output path. By [@felginep](https://github.com/felginep).
176
+ Fixes [#29](https://github.com/applidium/ad_localize/issues/29)
139
177
  - raise error when google spreadsheet key is invalid by [@felginep](https://github.com/felginep)
140
178
 
141
179
  ### Fixed
142
180
 
143
- - auto escape strings in Localizable.strings by [@felginep](https://github.com/felginep). Fixes [#26](https://github.com/applidium/ad_localize/issues/26)
144
- - trim keys to prevent user error by [@felginep](https://github.com/felginep). Fixes [#16](https://github.com/applidium/ad_localize/issues/16)
181
+ - auto escape strings in Localizable.strings by [@felginep](https://github.com/felginep).
182
+ Fixes [#26](https://github.com/applidium/ad_localize/issues/26)
183
+ - trim keys to prevent user error by [@felginep](https://github.com/felginep).
184
+ Fixes [#16](https://github.com/applidium/ad_localize/issues/16)
145
185
 
146
186
  ## [3.4.0] - 2019-02-10
147
187
 
148
188
  ### Added
149
189
 
150
- - Rails folks, [@epaillous](https://github.com/epaillous) has improved the YAML support. You can now have multi-level wording.
190
+ - Rails folks, [@epaillous](https://github.com/epaillous) has improved the YAML support. You can now have multi-level
191
+ wording.
151
192
 
152
193
  ## [3.3.0] - 2019-02-10
153
194
 
@@ -160,7 +201,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
160
201
  ### Added
161
202
 
162
203
  - Add tests to compare reference exports by [@felginep](https://github.com/felginep)
163
- - [iOS only] Handle [adaptive strings](https://developer.apple.com/documentation/foundation/nsstring/1413104-variantfittingpresentationwidth) by [@felginep](https://github.com/felginep)
204
+ - [iOS only]
205
+ Handle [adaptive strings](https://developer.apple.com/documentation/foundation/nsstring/1413104-variantfittingpresentationwidth)
206
+ by [@felginep](https://github.com/felginep)
164
207
 
165
208
  ### Changed
166
209
 
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ad_localize (4.0.9)
5
- activesupport (>= 6.1.3.2, < 7.0)
4
+ ad_localize (5.0.0)
5
+ activesupport (>= 6.1.3.2, < 8.0)
6
6
  colorize (~> 0.8)
7
7
  google-apis-sheets_v4 (~> 0.9)
8
8
  googleauth (~> 0.12)
@@ -11,41 +11,43 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- activesupport (6.1.4.1)
14
+ activesupport (7.0.3.1)
15
15
  concurrent-ruby (~> 1.0, >= 1.0.2)
16
16
  i18n (>= 1.6, < 2)
17
17
  minitest (>= 5.1)
18
18
  tzinfo (~> 2.0)
19
- zeitwerk (~> 2.3)
20
19
  addressable (2.8.0)
21
20
  public_suffix (>= 2.0.2, < 5.0)
22
21
  ansi (1.5.0)
23
22
  builder (3.2.4)
24
- byebug (11.1.3)
25
23
  colorize (0.8.1)
26
- concurrent-ruby (1.1.9)
24
+ concurrent-ruby (1.1.10)
27
25
  declarative (0.0.20)
28
- diffy (3.3.0)
29
- faraday (1.7.1)
26
+ diffy (3.4.2)
27
+ faraday (1.10.0)
30
28
  faraday-em_http (~> 1.0)
31
29
  faraday-em_synchrony (~> 1.0)
32
30
  faraday-excon (~> 1.1)
33
- faraday-httpclient (~> 1.0.1)
31
+ faraday-httpclient (~> 1.0)
32
+ faraday-multipart (~> 1.0)
34
33
  faraday-net_http (~> 1.0)
35
- faraday-net_http_persistent (~> 1.1)
34
+ faraday-net_http_persistent (~> 1.0)
36
35
  faraday-patron (~> 1.0)
37
36
  faraday-rack (~> 1.0)
38
- multipart-post (>= 1.2, < 3)
37
+ faraday-retry (~> 1.0)
39
38
  ruby2_keywords (>= 0.0.4)
40
39
  faraday-em_http (1.0.0)
41
40
  faraday-em_synchrony (1.0.0)
42
41
  faraday-excon (1.1.0)
43
42
  faraday-httpclient (1.0.1)
43
+ faraday-multipart (1.0.4)
44
+ multipart-post (~> 2)
44
45
  faraday-net_http (1.0.1)
45
46
  faraday-net_http_persistent (1.2.0)
46
47
  faraday-patron (1.0.0)
47
48
  faraday-rack (1.0.0)
48
- google-apis-core (0.4.1)
49
+ faraday-retry (1.0.3)
50
+ google-apis-core (0.7.0)
49
51
  addressable (~> 2.5, >= 2.5.1)
50
52
  googleauth (>= 0.16.2, < 2.a)
51
53
  httpclient (>= 2.8.1, < 3.a)
@@ -54,8 +56,8 @@ GEM
54
56
  retriable (>= 2.0, < 4.a)
55
57
  rexml
56
58
  webrick
57
- google-apis-sheets_v4 (0.9.0)
58
- google-apis-core (>= 0.4, < 2.a)
59
+ google-apis-sheets_v4 (0.17.0)
60
+ google-apis-core (>= 0.7, < 2.a)
59
61
  googleauth (0.17.1)
60
62
  faraday (>= 0.17.3, < 2.0)
61
63
  jwt (>= 1.4, < 3.0)
@@ -64,12 +66,12 @@ GEM
64
66
  os (>= 0.9, < 2.0)
65
67
  signet (~> 0.15)
66
68
  httpclient (2.8.3)
67
- i18n (1.8.10)
69
+ i18n (1.12.0)
68
70
  concurrent-ruby (~> 1.0)
69
- jwt (2.2.3)
71
+ jwt (2.4.1)
70
72
  memoist (0.16.2)
71
- mini_mime (1.1.1)
72
- mini_portile2 (2.6.1)
73
+ mini_mime (1.1.2)
74
+ mini_portile2 (2.8.0)
73
75
  minitest (5.14.4)
74
76
  minitest-reporters (1.4.2)
75
77
  ansi
@@ -77,15 +79,15 @@ GEM
77
79
  minitest (>= 5.0)
78
80
  ruby-progressbar
79
81
  multi_json (1.15.0)
80
- multipart-post (2.1.1)
81
- nokogiri (1.12.4)
82
- mini_portile2 (~> 2.6.1)
82
+ multipart-post (2.2.3)
83
+ nokogiri (1.13.8)
84
+ mini_portile2 (~> 2.8.0)
83
85
  racc (~> 1.4)
84
- os (1.1.1)
85
- public_suffix (4.0.6)
86
- racc (1.5.2)
86
+ os (1.1.4)
87
+ public_suffix (4.0.7)
88
+ racc (1.6.0)
87
89
  rake (12.3.3)
88
- representable (3.1.1)
90
+ representable (3.2.0)
89
91
  declarative (< 0.1.0)
90
92
  trailblazer-option (>= 0.1.1, < 0.2.0)
91
93
  uber (< 0.2.0)
@@ -93,17 +95,16 @@ GEM
93
95
  rexml (3.2.5)
94
96
  ruby-progressbar (1.10.1)
95
97
  ruby2_keywords (0.0.5)
96
- signet (0.16.0)
98
+ signet (0.17.0)
97
99
  addressable (~> 2.8)
98
- faraday (>= 0.17.3, < 2.0)
100
+ faraday (>= 0.17.5, < 3.a)
99
101
  jwt (>= 1.5, < 3.0)
100
102
  multi_json (~> 1.10)
101
- trailblazer-option (0.1.1)
102
- tzinfo (2.0.4)
103
+ trailblazer-option (0.1.2)
104
+ tzinfo (2.0.5)
103
105
  concurrent-ruby (~> 1.0)
104
106
  uber (0.1.0)
105
107
  webrick (1.7.0)
106
- zeitwerk (2.4.2)
107
108
 
108
109
  PLATFORMS
109
110
  ruby
@@ -111,11 +112,10 @@ PLATFORMS
111
112
  DEPENDENCIES
112
113
  ad_localize!
113
114
  bundler (>= 1.12.0, < 3.0.0)
114
- byebug (~> 11.0)
115
115
  diffy (~> 3.3)
116
116
  minitest (~> 5.11)
117
117
  minitest-reporters (~> 1.3)
118
- rake (~> 12.3)
118
+ rake (>= 12.3.0, < 14.0.0)
119
119
 
120
120
  BUNDLED WITH
121
121
  2.2.26
data/README.md CHANGED
@@ -66,6 +66,11 @@ $ ad_localize -t <path-to-the-output-directory>
66
66
  $ ad_localize -d
67
67
  ```
68
68
 
69
+ * Won't generate keys with empty values (iOS feature only, automatically handled for Android)
70
+ ```
71
+ $ ad_localize -x
72
+ ```
73
+
69
74
  ### In a Ruby program
70
75
  There are many possibilities when using AdLocalize in a ruby program. You can add support to your own wording format, support other platforms, select which locales you want to export, generate wording file content without writing on the disk and many more.
71
76
 
@@ -123,6 +128,7 @@ $ ad_localize -k <your-spreadsheet-drive-key> -s <comma-separated-sheet-id-list>
123
128
  - Any column after the `key` column will be considered as a locale column (except from the optional `comment` columns)
124
129
  - Keys should contain only letter, number, underscore and dot : [a-z0-9_.]+.
125
130
  - Format specifiers must be numeroted if there are more than one in a translation string (eg: `"%1$@ %2$@'s report"`).
131
+ - _Only for Android_ keys without translation won't be considered
126
132
 
127
133
  ### Comments
128
134
 
data/ad_localize.gemspec CHANGED
@@ -21,9 +21,10 @@ Gem::Specification.new do |spec|
21
21
  'Claire Peyron',
22
22
  'Claire Dufetrelle',
23
23
  'Pierre Felgines',
24
- 'Satyan Jacquens'
24
+ 'Satyan Jacquens',
25
+ 'Thomas Esterlin'
25
26
  ]
26
- spec.email = %w(joanna.vigne@fabernovel.com hugo.hache@fabernovel.com edouard.siegel@fabernovel.com)
27
+ spec.email = %w(joanna.vigne@fabernovel.com pierre.felgines@fabernovel.com edouard.siegel@fabernovel.com)
27
28
 
28
29
  spec.summary = %q{AdLocalize helps with mobile and web applications wording}
29
30
  spec.description = %q{AdLocalize produces localization files from platform agnostic wording.
@@ -40,17 +41,16 @@ Gem::Specification.new do |spec|
40
41
  spec.require_paths = ['lib']
41
42
 
42
43
  spec.add_development_dependency 'bundler', '>= 1.12.0', '< 3.0.0'
43
- spec.add_development_dependency 'rake', '~> 12.3'
44
+ spec.add_development_dependency 'rake', '>= 12.3.0', '< 14.0.0'
44
45
  spec.add_development_dependency 'minitest', '~> 5.11'
45
- spec.add_development_dependency 'byebug', '~> 11.0'
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', '>= 6.1.3.2', '< 7.0'
49
+ spec.add_dependency 'activesupport', '>= 6.1.3.2', '< 8.0'
50
50
  spec.add_dependency 'nokogiri', '~> 1.10'
51
51
  spec.add_dependency 'colorize', '~> 0.8'
52
52
  spec.add_dependency 'googleauth', '~> 0.12'
53
53
  spec.add_dependency 'google-apis-sheets_v4', '~> 0.9'
54
54
 
55
- spec.required_ruby_version = '>= 2.3'
55
+ spec.required_ruby_version = '>= 2.7'
56
56
  end
data/bin/console CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  require "bundler/setup"
4
4
  require "ad_localize"
5
- require 'byebug'
6
5
 
7
6
  # You can add fixtures and/or initialization code here to make experimenting
8
7
  # with your gem easier. You can also use a different console, if you like.
@@ -23,6 +23,10 @@ module AdLocalize
23
23
  o.value == value &&
24
24
  o.comment == comment
25
25
  end
26
+
27
+ def has_value?
28
+ value.present?
29
+ end
26
30
  end
27
31
  end
28
32
  end
@@ -11,6 +11,7 @@ module AdLocalize
11
11
  print_export_request(export_request: export_request) if export_request.verbose?
12
12
  LOGGER.debug("Checking request validity")
13
13
  return unless export_request.valid?
14
+
14
15
  if export_request.has_csv_files?
15
16
  ExportCSVFiles.new(csv_path_to_wording: @csv_path_to_wording).call(export_request: export_request)
16
17
  elsif export_request.has_g_spreadsheet_options?
@@ -27,6 +28,7 @@ module AdLocalize
27
28
  LOGGER.debug("platforms : #{export_request.platforms.to_sentence}")
28
29
  LOGGER.debug("output_path : #{export_request.output_path}")
29
30
  LOGGER.debug("verbose : #{export_request.verbose}")
31
+ LOGGER.debug("non_empty_values : #{export_request.non_empty_values}")
30
32
  LOGGER.debug("merge_policy : #{export_request.merge_policy&.policy}")
31
33
  LOGGER.debug("csv_paths : #{export_request.csv_paths.to_sentence}")
32
34
  if export_request.has_g_spreadsheet_options?
@@ -4,13 +4,16 @@ module AdLocalize
4
4
  def initialize(csv_path_to_wording: nil)
5
5
  @csv_path_to_wording = csv_path_to_wording.presence || Mappers::CSVPathToWording.new
6
6
  @merge_wordings = MergeWordings.new
7
+ @export_wording = ExportWording.new
7
8
  end
8
9
 
9
10
  def call(export_request:)
10
11
  LOGGER.debug("Starting export csv files : #{export_request.csv_paths.to_sentence}")
11
- wordings = export_request.csv_paths.map { |csv_path| @csv_path_to_wording.map(csv_path: csv_path) }
12
- wording = @merge_wordings.call(wordings: wordings.compact, merge_policy: export_request.merge_policy)
13
- ExportWording.new.call(export_request: export_request, wording: wording)
12
+ wordings = export_request.csv_paths.map { |csv_path| @csv_path_to_wording.map(csv_path: csv_path) }.compact
13
+ return if wordings.blank?
14
+
15
+ wording = @merge_wordings.call(wordings: wordings, merge_policy: export_request.merge_policy)
16
+ @export_wording.call(export_request: export_request, wording: wording)
14
17
  end
15
18
  end
16
19
  end
@@ -4,6 +4,9 @@ module AdLocalize
4
4
  def initialize(value_range_to_wording: nil)
5
5
  @value_range_to_wording = value_range_to_wording.presence || Mappers::ValueRangeToWording.new
6
6
  @g_sheets_repository = Repositories::GSheetsRepository.new
7
+ @export_wording = ExportWording.new
8
+ @merge_wordings = MergeWordings.new
9
+ @export_csv_files = ExportCSVFiles.new
7
10
  end
8
11
 
9
12
  def call(export_request:)
@@ -20,9 +23,11 @@ module AdLocalize
20
23
  def export_with_service_account(export_request:)
21
24
  LOGGER.debug("Using service account")
22
25
  value_ranges = @g_sheets_repository.get_sheets_values(g_spreadsheet_options: export_request.g_spreadsheet_options)
23
- wordings = value_ranges.map { |value_range| @value_range_to_wording.map(value_range: value_range) }
24
- wording = MergeWordings.new.call(wordings: wordings.compact, merge_policy: export_request.merge_policy)
25
- ExportWording.new.call(export_request: export_request, wording: wording)
26
+ wordings = value_ranges.map { |value_range| @value_range_to_wording.map(value_range: value_range) }.compact
27
+ return if wordings.blank?
28
+
29
+ wording = @merge_wordings.call(wordings: wordings, merge_policy: export_request.merge_policy)
30
+ @export_wording.call(export_request: export_request, wording: wording)
26
31
  end
27
32
 
28
33
  def export_without_service_account(export_request:)
@@ -32,7 +37,7 @@ module AdLocalize
32
37
  end
33
38
  export_request.csv_paths = downloaded_files.map(&:path)
34
39
  if export_request.has_csv_files?
35
- ExportCSVFiles.new.call(export_request: export_request)
40
+ @export_csv_files.call(export_request: export_request)
36
41
  elsif export_request.has_empty_files?
37
42
  # When downloading an empty spreadsheet, the content type of the downloaded file is "inode/x-empty"
38
43
  LOGGER.warn("Your spreadsheet is empty. Add content and retry.")
@@ -8,23 +8,26 @@ module AdLocalize
8
8
  def call(export_request:, wording:)
9
9
  LOGGER.debug("Starting export wording")
10
10
  export_request.platforms.each do |platform|
11
- platform_dir = compute_platform_dir(export_request: export_request, platform: platform)
12
- export_platform = @export_platform_factory.build(platform: platform)
13
- if export_platform.should_export_locale_by_locale?
14
- locales = export_request.locales.size.zero? ? wording.locales : wording.locales & export_request.locales
15
- locales.each do |locale|
16
- export_platform.call(wording: wording, locale: locale, platform_dir: platform_dir)
17
- end
18
- else
19
- export_platform.call(export_request: export_request, platform_dir: platform_dir)
20
- end
11
+ platform_interactor = @export_platform_factory.build(platform: platform)
12
+ options = build_export_wording_options(wording: wording, export_request: export_request, platform: platform)
13
+ platform_interactor.call(export_wording_options: options)
21
14
  end
22
15
  end
23
16
 
24
17
  private
25
18
 
26
- def compute_platform_dir(export_request:, platform:)
27
- export_request.multiple_platforms? ? export_request.output_path.join(platform.to_s) : export_request.output_path
19
+ def build_export_wording_options(wording:, export_request:, platform:)
20
+ platform_output_directory = export_request.output_path
21
+ platform_output_directory = platform_output_directory.join(platform.to_s) if export_request.multiple_platforms?
22
+ locales = export_request.locales.size.zero? ? wording.locales : wording.locales & export_request.locales
23
+
24
+ Requests::ExportWordingOptions.new(
25
+ locales: locales,
26
+ wording: wording,
27
+ platform_output_directory: platform_output_directory,
28
+ bypass_empty_values: export_request.non_empty_values,
29
+ csv_paths: export_request.csv_paths
30
+ )
28
31
  end
29
32
  end
30
33
  end
@@ -10,21 +10,22 @@ module AdLocalize
10
10
  @file_system_repository = Repositories::FileSystemRepository.new
11
11
  end
12
12
 
13
- def call(wording:, locale:, platform_dir:)
14
- LOGGER.debug("Starting export Android wording for locale #{locale}")
15
- locale_wording = wording.translations_for(locale: locale)
16
- return unless has_android_wording?(locale_wording: locale_wording)
17
-
18
- output_dir = compute_output_dir(wording: wording, locale: locale, platform_dir: platform_dir)
19
- @file_system_repository.create_directory(path: output_dir)
20
-
21
- content = @strings_serializer.render(locale_wording: locale_wording)
22
- @file_system_repository.write(content: content, path: output_dir.join(STRINGS_FILENAME))
23
- LOGGER.debug("#{STRINGS_FILENAME} done !")
24
- end
25
-
26
- def should_export_locale_by_locale?
27
- true
13
+ def call(export_wording_options:)
14
+ platform_dir = export_wording_options.platform_output_directory
15
+ wording = export_wording_options.wording
16
+
17
+ export_wording_options.locales.each do |locale|
18
+ LOGGER.debug("Starting export Android wording for locale #{locale}")
19
+ locale_wording = export_wording_options.wording.translations_for(locale: locale)
20
+ return unless has_android_wording?(locale_wording: locale_wording)
21
+
22
+ output_dir = compute_output_dir(wording: wording, locale: locale, platform_dir: platform_dir)
23
+ @file_system_repository.create_directory(path: output_dir)
24
+
25
+ content = @strings_serializer.render(locale_wording: locale_wording)
26
+ @file_system_repository.write(content: content, path: output_dir.join(STRINGS_FILENAME))
27
+ LOGGER.debug("#{STRINGS_FILENAME} done !")
28
+ end
28
29
  end
29
30
 
30
31
  private
@@ -6,19 +6,16 @@ module AdLocalize
6
6
  @file_system_repository = Repositories::FileSystemRepository.new
7
7
  end
8
8
 
9
- def call(export_request:, platform_dir:)
9
+ def call(export_wording_options:)
10
10
  LOGGER.debug("Starting export CSV wording")
11
- @file_system_repository.create_directory(path: platform_dir)
12
- export_request.csv_paths.each_with_index do |csv_path, i|
11
+ @file_system_repository.create_directory(path: export_wording_options.platform_output_directory)
12
+ export_wording_options.csv_paths.each_with_index do |csv_path, i|
13
13
  file = File.basename("localization_#{i}.csv")
14
- FileUtils.cp(csv_path, platform_dir.join(file.to_s))
14
+ output_path = export_wording_options.platform_output_directory.join(file.to_s)
15
+ FileUtils.cp(csv_path, output_path)
15
16
  end
16
17
  LOGGER.debug("CSV wording export done !")
17
18
  end
18
-
19
- def should_export_locale_by_locale?
20
- false
21
- end
22
19
  end
23
20
  end
24
21
  end
@@ -9,30 +9,34 @@ module AdLocalize
9
9
 
10
10
  def initialize
11
11
  @info_plist_serializer = Serializers::InfoPlistSerializer.new
12
- @localizable_strings_serializer = Serializers::LocalizableStringsSerializer.new
13
- @localizable_stringsdict_serializer = Serializers::LocalizableStringsdictSerializer.new
12
+ @strings_serializer = Serializers::LocalizableStringsSerializer.new
13
+ @stringsdict_serializer = Serializers::LocalizableStringsdictSerializer.new
14
14
  @file_system_repository = Repositories::FileSystemRepository.new
15
15
  end
16
16
 
17
- def call(wording:, locale:, platform_dir:)
18
- LOGGER.debug("Starting export iOS wording for locale #{locale}")
19
- locale_wording = wording.translations_for(locale: locale)
20
- return unless has_ios_wording?(locale_wording: locale_wording)
17
+ def call(export_wording_options:)
18
+ bypass_empty_values = export_wording_options.bypass_empty_values
21
19
 
22
- output_dir = platform_dir.join(LOCALE_DIRECTORY_CONVENTION % { locale: locale })
23
- @file_system_repository.create_directory(path: output_dir)
20
+ export_wording_options.locales.each do |locale|
21
+ LOGGER.debug("Starting export iOS wording for locale #{locale}")
22
+ locale_wording = export_wording_options.wording.translations_for(locale: locale)
23
+ next unless has_ios_wording?(locale_wording: locale_wording)
24
24
 
25
- export_info_plist(locale_wording: locale_wording, output_dir: output_dir)
26
- export_localizable_strings(locale_wording: locale_wording, output_dir: output_dir)
27
- export_localizable_stringsdict(locale_wording: locale_wording, output_dir: output_dir)
28
- end
29
-
30
- def should_export_locale_by_locale?
31
- true
25
+ locale_directory_name = LOCALE_DIRECTORY_CONVENTION % { locale: locale }
26
+ output_dir = export_wording_options.platform_output_directory.join(locale_directory_name)
27
+ @file_system_repository.create_directory(path: output_dir)
28
+ export_files(locale_wording: locale_wording, output_dir: output_dir, bypass_empty_values: bypass_empty_values)
29
+ end
32
30
  end
33
31
 
34
32
  private
35
33
 
34
+ def export_files(locale_wording:, output_dir:, bypass_empty_values:)
35
+ export_info_plist(locale_wording: locale_wording, output_dir: output_dir)
36
+ export_localizable_strings(locale_wording: locale_wording, output_dir: output_dir, bypass_empty_values: bypass_empty_values)
37
+ export_localizable_stringsdict(locale_wording: locale_wording, output_dir: output_dir, bypass_empty_values: bypass_empty_values)
38
+ end
39
+
36
40
  def has_ios_wording?(locale_wording:)
37
41
  locale_wording.has_info_plist_keys? ||
38
42
  locale_wording.has_singular_keys? ||
@@ -42,21 +46,26 @@ module AdLocalize
42
46
 
43
47
  def export_info_plist(locale_wording:, output_dir:)
44
48
  return unless locale_wording.has_info_plist_keys?
49
+
45
50
  content = @info_plist_serializer.render(locale_wording: locale_wording)
46
51
  @file_system_repository.write(content: content, path: output_dir.join(INFO_PLIST_FILENAME))
47
52
  LOGGER.debug("#{INFO_PLIST_FILENAME} done !")
48
53
  end
49
54
 
50
- def export_localizable_strings(locale_wording:, output_dir:)
55
+ def export_localizable_strings(locale_wording:, output_dir:, bypass_empty_values:)
51
56
  return unless locale_wording.has_singular_keys?
52
- content = @localizable_strings_serializer.render(locale_wording: locale_wording)
57
+
58
+ @strings_serializer.bypass_empty_values = bypass_empty_values
59
+ content = @strings_serializer.render(locale_wording: locale_wording)
53
60
  @file_system_repository.write(content: content, path: output_dir.join(LOCALIZABLE_STRINGS_FILENAME))
54
61
  LOGGER.debug("#{LOCALIZABLE_STRINGS_FILENAME} done !")
55
62
  end
56
63
 
57
- def export_localizable_stringsdict(locale_wording:, output_dir:)
64
+ def export_localizable_stringsdict(locale_wording:, output_dir:, bypass_empty_values:)
58
65
  return unless locale_wording.has_plural_keys? || locale_wording.has_adaptive_keys?
59
- content = @localizable_stringsdict_serializer.render(locale_wording: locale_wording)
66
+
67
+ @stringsdict_serializer.bypass_empty_values = bypass_empty_values
68
+ content = @stringsdict_serializer.render(locale_wording: locale_wording)
60
69
  @file_system_repository.write(content: content, path: output_dir.join(LOCALIZABLE_STRINGSDICT_FILENAME))
61
70
  LOGGER.debug("#{LOCALIZABLE_STRINGSDICT_FILENAME} done !")
62
71
  end
@@ -7,19 +7,19 @@ module AdLocalize
7
7
  @file_system_repository = Repositories::FileSystemRepository.new
8
8
  end
9
9
 
10
- def call(wording:, locale:, platform_dir:)
11
- LOGGER.debug("Starting export JSON wording for locale #{locale}")
12
- locale_wording = wording.translations_for(locale: locale)
13
- content = @json_serializer.render(locale_wording: locale_wording)
14
- return if content[locale].blank?
10
+ def call(export_wording_options:)
11
+ output_dir = export_wording_options.platform_output_directory
15
12
 
16
- @file_system_repository.create_directory(path: platform_dir)
17
- @file_system_repository.write(content: content, path: platform_dir.join("#{locale}.json"))
18
- LOGGER.debug("#{locale}.json done !")
19
- end
13
+ export_wording_options.locales.each do |locale|
14
+ LOGGER.debug("Starting export JSON wording for locale #{locale}")
15
+ locale_wording = export_wording_options.wording.translations_for(locale: locale)
16
+ content = @json_serializer.render(locale_wording: locale_wording)
17
+ next if content[locale].blank?
20
18
 
21
- def should_export_locale_by_locale?
22
- true
19
+ @file_system_repository.create_directory(path: output_dir)
20
+ @file_system_repository.write(content: content, path: output_dir.join("#{locale}.json"))
21
+ LOGGER.debug("#{locale}.json done !")
22
+ end
23
23
  end
24
24
  end
25
25
  end
@@ -7,19 +7,18 @@ module AdLocalize
7
7
  @file_system_repository = Repositories::FileSystemRepository.new
8
8
  end
9
9
 
10
- def call(wording:, locale:, platform_dir:)
11
- LOGGER.debug("Starting export Properties wording for locale #{locale}")
12
- locale_wording = wording.translations_for(locale: locale)
13
- return unless has_properties_wording?(locale_wording: locale_wording)
10
+ def call(export_wording_options:)
11
+ export_wording_options.locales.each do |locale|
12
+ LOGGER.debug("Starting export Properties wording for locale #{locale}")
13
+ locale_wording = export_wording_options.wording.translations_for(locale: locale)
14
+ return unless has_properties_wording?(locale_wording: locale_wording)
14
15
 
15
- content = @properties_serializer.render(locale_wording: locale_wording)
16
- @file_system_repository.create_directory(path: platform_dir)
17
- @file_system_repository.write(content: content, path: platform_dir.join("#{locale}.properties"))
18
- LOGGER.debug("#{locale}.properties done !")
19
- end
20
-
21
- def should_export_locale_by_locale?
22
- true
16
+ content = @properties_serializer.render(locale_wording: locale_wording)
17
+ @file_system_repository.create_directory(path: export_wording_options.platform_output_directory)
18
+ output_path = export_wording_options.platform_output_directory.join("#{locale}.properties")
19
+ @file_system_repository.write(content: content, path: output_path)
20
+ LOGGER.debug("#{locale}.properties done !")
21
+ end
23
22
  end
24
23
 
25
24
  private
@@ -7,19 +7,19 @@ module AdLocalize
7
7
  @file_system_repository = Repositories::FileSystemRepository.new
8
8
  end
9
9
 
10
- def call(wording:, locale:, platform_dir:)
11
- LOGGER.debug("Starting export YAML wording for locale #{locale}")
12
- locale_wording = wording.translations_for(locale: locale)
13
- content = @yaml_serializer.render(locale_wording:locale_wording)
14
- return if content[locale].blank?
10
+ def call(export_wording_options:)
11
+ output_dir = export_wording_options.platform_output_directory
15
12
 
16
- @file_system_repository.create_directory(path: platform_dir)
17
- @file_system_repository.write(content: content, path: platform_dir.join("#{locale}.yml"))
18
- LOGGER.debug("#{locale}.yml done !")
19
- end
13
+ export_wording_options.locales.each do |locale|
14
+ LOGGER.debug("Starting export YAML wording for locale #{locale}")
15
+ locale_wording = export_wording_options.wording.translations_for(locale: locale)
16
+ content = @yaml_serializer.render(locale_wording: locale_wording)
17
+ next if content[locale].blank?
20
18
 
21
- def should_export_locale_by_locale?
22
- true
19
+ @file_system_repository.create_directory(path: output_dir)
20
+ @file_system_repository.write(content: content, path: output_dir.join("#{locale}.yml"))
21
+ LOGGER.debug("#{locale}.yml done !")
22
+ end
23
23
  end
24
24
  end
25
25
  end
@@ -9,9 +9,17 @@ module AdLocalize
9
9
  processedValue = processedValue.gsub(/(?<!\\)\"/, '&#34;') # match " unless there is a \ before
10
10
  processedValue = processedValue.gsub(">", '&gt;')
11
11
  processedValue = processedValue.gsub("<", '&lt;')
12
+ hasFormatting = processedValue.match(/(%(\d+\$)?@)/)
12
13
  processedValue = processedValue.gsub(/(%(\d+\$)?@)/, '%\2s') # should match values like %1$s and %s
14
+ hasFormatting = hasFormatting || processedValue.match(/(%((\d+\$)?(\d+)?)i)/)
13
15
  processedValue = processedValue.gsub(/(%((\d+\$)?(\d+)?)i)/, '%\2d') # should match values like %i, %3$i, %01i, %1$02i
14
- processedValue = processedValue.gsub(/%(?!((\d+\$)?(s|(\d+)?d)))/, '&#37;') # negative lookahead: identifies when user really wants to display a %
16
+ # On Android, '%' must be escaped with a second '%' if and only if the string has at least one formatting pattern. In this specific case,
17
+ # a Java formatting method will be used which interprets every non escaped '%' as the start of a formatting pattern.
18
+ if hasFormatting
19
+ processedValue = processedValue.gsub(/%(?!((\d+\$)?(s|(\d+)?d)))/, '%%') # negative lookahead: identifies when user really wants to display a %
20
+ else
21
+ processedValue = processedValue.gsub(/%(?!((\d+\$)?(s|(\d+)?d)))/, '%') # negative lookahead: identifies when user really wants to display a %
22
+ end
15
23
  processedValue = processedValue.gsub("\\U", "\\u")
16
24
  processedValue = processedValue.gsub(/&(?!((#\d+)|(\w+));)/, '&#38;')
17
25
  processedValue = processedValue.gsub(/&/) { |match| match.replace('\&') }
@@ -6,6 +6,7 @@ module AdLocalize
6
6
  platforms: options[:only],
7
7
  g_spreadsheet_options: map_g_spreadsheet_options(options: options),
8
8
  verbose: options[:debug],
9
+ non_empty_values: options[:'non-empty-values'],
9
10
  output_path: options[:'target-dir'],
10
11
  merge_policy: options[:'merge-policy'],
11
12
  csv_paths: options[:csv_paths]
@@ -27,6 +27,7 @@ module AdLocalize
27
27
  parser.on("-o", "--only PLATFORMS", Array, "PLATFORMS is a comma separated list. Only generate localisation files for the specified platforms. Supported platforms : #{Requests::ExportRequest::SUPPORTED_PLATFORMS.to_sentence}")
28
28
  parser.on("-s", "--sheets SHEET_IDS", Array, "SHEET_IDS is a comma separated list. Use a specific sheet id for Google Drive spreadsheets with several sheets")
29
29
  parser.on("-t", "--target-dir PATH", String, "Path to the target directory")
30
+ parser.on("-x", "--non-empty-values", TrueClass, "Do not export keys with empty values (iOS only)")
30
31
  end
31
32
 
32
33
  args = {}
@@ -12,6 +12,7 @@ module AdLocalize
12
12
  @csv_paths = Array(args[:csv_paths])
13
13
  @g_spreadsheet_options = args[:g_spreadsheet_options]
14
14
  @verbose = args[:verbose].presence || false
15
+ @non_empty_values = args[:non_empty_values].presence || false
15
16
  @output_path = Pathname.new(args[:output_path].presence || DEFAULT_EXPORT_FOLDER)
16
17
  if @csv_paths.size > 1 || @g_spreadsheet_options&.has_multiple_sheets?
17
18
  @merge_policy = MergePolicy.new(policy: args[:merge_policy].presence || MergePolicy::DEFAULT_POLICY)
@@ -26,6 +27,7 @@ module AdLocalize
26
27
  :g_spreadsheet_options,
27
28
  :output_path,
28
29
  :verbose,
30
+ :non_empty_values,
29
31
  :merge_policy
30
32
  )
31
33
 
@@ -55,6 +57,10 @@ module AdLocalize
55
57
  verbose
56
58
  end
57
59
 
60
+ def non_empty_values?
61
+ non_empty_values
62
+ end
63
+
58
64
  private
59
65
 
60
66
  def valid_csv_options?
@@ -0,0 +1,24 @@
1
+ module AdLocalize
2
+ module Requests
3
+ class ExportWordingOptions
4
+ def initialize(wording:, platform_output_directory:, locales: [], bypass_empty_values: false, csv_paths: [])
5
+ @wording = wording
6
+ @locales = locales
7
+ @platform_output_directory = platform_output_directory
8
+ @bypass_empty_values = bypass_empty_values
9
+ @csv_paths = csv_paths
10
+ end
11
+
12
+ attr_reader(
13
+ :wording,
14
+ :platform_output_directory,
15
+ :bypass_empty_values,
16
+ :locales
17
+ )
18
+
19
+ attr_accessor(
20
+ :csv_paths
21
+ )
22
+ end
23
+ end
24
+ end
@@ -9,6 +9,10 @@ module AdLocalize
9
9
  @translation_mapper = Mappers::IOSTranslationMapper.new
10
10
  end
11
11
 
12
+ attr_accessor(
13
+ :bypass_empty_values
14
+ )
15
+
12
16
  private
13
17
 
14
18
  def template_path
@@ -20,7 +24,7 @@ module AdLocalize
20
24
  end
21
25
 
22
26
  def map_translations(translations:)
23
- translations.map { |translation| @translation_mapper.map(translation: translation) }
27
+ translations.select(&:has_value?).map { |translation| @translation_mapper.map(translation: translation) }
24
28
  end
25
29
  end
26
30
  end
@@ -10,6 +10,10 @@ module AdLocalize
10
10
  @translation_group_mapper = Mappers::TranslationGroupMapper.new(translation_mapper: @translation_mapper)
11
11
  end
12
12
 
13
+ attr_accessor(
14
+ :bypass_empty_values
15
+ )
16
+
13
17
  private
14
18
 
15
19
  def template_path
@@ -24,11 +28,13 @@ module AdLocalize
24
28
  end
25
29
 
26
30
  def map_plurals(plurals:)
27
- plurals.map { |label, translations| @translation_group_mapper.map(label: label, translations: translations) }
31
+ plurals.map { |label, translations| @translation_group_mapper.map(label: label, translations: translations.select(&:has_value?)) }
32
+ .select(&:has_translations?)
28
33
  end
29
34
 
30
35
  def map_adaptives(adaptives:)
31
- adaptives.map { |label, translations| @translation_group_mapper.map(label: label, translations: translations) }
36
+ adaptives.map { |label, translations| @translation_group_mapper.map(label: label, translations: translations.select(&:has_value?)) }
37
+ .select(&:has_translations?)
32
38
  end
33
39
  end
34
40
  end
@@ -22,11 +22,13 @@ module AdLocalize
22
22
  end
23
23
 
24
24
  def map_singulars(translations:)
25
- translations.map { |translation| @translation_mapper.map(translation: translation) }
25
+ translations.select(&:has_value?).map { |translation| @translation_mapper.map(translation: translation) }
26
26
  end
27
27
 
28
28
  def map_plurals(plurals:)
29
- plurals.map { |label, translations| @translation_group_mapper.map(label: label, translations: translations) }
29
+ plurals
30
+ .map { |label, translations| @translation_group_mapper.map(label: label, translations: translations.select(&:has_value?)) }
31
+ .select(&:has_translations?)
30
32
  end
31
33
  end
32
34
  end
@@ -1,3 +1,3 @@
1
1
  module AdLocalize
2
- VERSION = "4.0.9"
2
+ VERSION = "5.0.0"
3
3
  end
@@ -10,6 +10,10 @@ module AdLocalize
10
10
  @label = label
11
11
  @translation_view_models = translation_view_models
12
12
  end
13
+
14
+ def has_translations?
15
+ (translation_view_models || []).any?(&:has_value?)
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -14,6 +14,10 @@ module AdLocalize
14
14
  @value = value
15
15
  @comment = comment
16
16
  end
17
+
18
+ def has_value?
19
+ value.present?
20
+ end
17
21
  end
18
22
  end
19
23
  end
data/lib/ad_localize.rb CHANGED
@@ -41,6 +41,7 @@ require 'ad_localize/entities/wording'
41
41
 
42
42
  require 'ad_localize/requests/g_spreadsheet_options'
43
43
  require 'ad_localize/requests/export_request'
44
+ require 'ad_localize/requests/export_wording_options'
44
45
  require 'ad_localize/requests/merge_policy'
45
46
 
46
47
  require 'ad_localize/interactors/merge_wordings'
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.9
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edouard Siegel
@@ -17,7 +17,8 @@ authors:
17
17
  - Claire Dufetrelle
18
18
  - Pierre Felgines
19
19
  - Satyan Jacquens
20
- autorequire:
20
+ - Thomas Esterlin
21
+ autorequire:
21
22
  bindir: exe
22
23
  cert_chain: []
23
24
  date: 2018-04-18 00:00:00.000000000 Z
@@ -46,16 +47,22 @@ dependencies:
46
47
  name: rake
47
48
  requirement: !ruby/object:Gem::Requirement
48
49
  requirements:
49
- - - "~>"
50
+ - - ">="
50
51
  - !ruby/object:Gem::Version
51
- version: '12.3'
52
+ version: 12.3.0
53
+ - - "<"
54
+ - !ruby/object:Gem::Version
55
+ version: 14.0.0
52
56
  type: :development
53
57
  prerelease: false
54
58
  version_requirements: !ruby/object:Gem::Requirement
55
59
  requirements:
56
- - - "~>"
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 12.3.0
63
+ - - "<"
57
64
  - !ruby/object:Gem::Version
58
- version: '12.3'
65
+ version: 14.0.0
59
66
  - !ruby/object:Gem::Dependency
60
67
  name: minitest
61
68
  requirement: !ruby/object:Gem::Requirement
@@ -70,20 +77,6 @@ dependencies:
70
77
  - - "~>"
71
78
  - !ruby/object:Gem::Version
72
79
  version: '5.11'
73
- - !ruby/object:Gem::Dependency
74
- name: byebug
75
- requirement: !ruby/object:Gem::Requirement
76
- requirements:
77
- - - "~>"
78
- - !ruby/object:Gem::Version
79
- version: '11.0'
80
- type: :development
81
- prerelease: false
82
- version_requirements: !ruby/object:Gem::Requirement
83
- requirements:
84
- - - "~>"
85
- - !ruby/object:Gem::Version
86
- version: '11.0'
87
80
  - !ruby/object:Gem::Dependency
88
81
  name: minitest-reporters
89
82
  requirement: !ruby/object:Gem::Requirement
@@ -121,7 +114,7 @@ dependencies:
121
114
  version: 6.1.3.2
122
115
  - - "<"
123
116
  - !ruby/object:Gem::Version
124
- version: '7.0'
117
+ version: '8.0'
125
118
  type: :runtime
126
119
  prerelease: false
127
120
  version_requirements: !ruby/object:Gem::Requirement
@@ -131,7 +124,7 @@ dependencies:
131
124
  version: 6.1.3.2
132
125
  - - "<"
133
126
  - !ruby/object:Gem::Version
134
- version: '7.0'
127
+ version: '8.0'
135
128
  - !ruby/object:Gem::Dependency
136
129
  name: nokogiri
137
130
  requirement: !ruby/object:Gem::Requirement
@@ -193,7 +186,7 @@ description: |-
193
186
  Supported wording format : CSV. Supported export format: iOS, Android, JSON and YAML
194
187
  email:
195
188
  - joanna.vigne@fabernovel.com
196
- - hugo.hache@fabernovel.com
189
+ - pierre.felgines@fabernovel.com
197
190
  - edouard.siegel@fabernovel.com
198
191
  executables:
199
192
  - ad_localize
@@ -247,6 +240,7 @@ files:
247
240
  - lib/ad_localize/repositories/file_system_repository.rb
248
241
  - lib/ad_localize/repositories/g_sheets_repository.rb
249
242
  - lib/ad_localize/requests/export_request.rb
243
+ - lib/ad_localize/requests/export_wording_options.rb
250
244
  - lib/ad_localize/requests/g_spreadsheet_options.rb
251
245
  - lib/ad_localize/requests/merge_policy.rb
252
246
  - lib/ad_localize/serializers/info_plist_serializer.rb
@@ -270,7 +264,7 @@ homepage: https://github.com/applidium/ad_localize
270
264
  licenses:
271
265
  - MIT
272
266
  metadata: {}
273
- post_install_message:
267
+ post_install_message:
274
268
  rdoc_options: []
275
269
  require_paths:
276
270
  - lib
@@ -278,15 +272,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
278
272
  requirements:
279
273
  - - ">="
280
274
  - !ruby/object:Gem::Version
281
- version: '2.3'
275
+ version: '2.7'
282
276
  required_rubygems_version: !ruby/object:Gem::Requirement
283
277
  requirements:
284
278
  - - ">="
285
279
  - !ruby/object:Gem::Version
286
280
  version: '0'
287
281
  requirements: []
288
- rubygems_version: 3.2.26
289
- signing_key:
282
+ rubygems_version: 3.2.15
283
+ signing_key:
290
284
  specification_version: 4
291
285
  summary: AdLocalize helps with mobile and web applications wording
292
286
  test_files: []