ad_localize 5.0.0 → 6.0.0
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 +6 -3
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +319 -0
- data/CHANGELOG.md +24 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +54 -48
- data/README.md +32 -10
- data/Rakefile +1 -0
- data/ad_localize.gemspec +10 -9
- data/bin/console +1 -0
- data/exe/ad_localize +2 -1
- data/lib/ad_localize/ad_logger.rb +5 -10
- data/lib/ad_localize/cli.rb +10 -3
- data/lib/ad_localize/entities/key.rb +3 -76
- data/lib/ad_localize/entities/locale_wording.rb +32 -52
- data/lib/ad_localize/entities/platform.rb +13 -0
- data/lib/ad_localize/entities/simple_wording.rb +6 -0
- data/lib/ad_localize/entities/wording_type.rb +11 -0
- data/lib/ad_localize/interactors/base_generate_files.rb +37 -0
- data/lib/ad_localize/interactors/download_spreadsheets.rb +20 -0
- data/lib/ad_localize/interactors/export_wording.rb +26 -20
- data/lib/ad_localize/interactors/generate_info_plist.rb +24 -0
- data/lib/ad_localize/interactors/generate_ios_files.rb +12 -0
- data/lib/ad_localize/interactors/generate_json.rb +20 -0
- data/lib/ad_localize/interactors/generate_localizable_strings.rb +24 -0
- data/lib/ad_localize/interactors/generate_localizable_strings_dict.rb +24 -0
- data/lib/ad_localize/interactors/generate_properties.rb +20 -0
- data/lib/ad_localize/interactors/generate_strings.rb +25 -0
- data/lib/ad_localize/interactors/generate_yaml.rb +20 -0
- data/lib/ad_localize/interactors/merge_wordings.rb +49 -18
- data/lib/ad_localize/interactors/parse_csv_files.rb +22 -0
- data/lib/ad_localize/interactors/process_export_request.rb +21 -0
- data/lib/ad_localize/mappers/locale_wording_to_hash.rb +45 -24
- data/lib/ad_localize/mappers/options_to_export_request.rb +14 -22
- data/lib/ad_localize/option_handler.rb +50 -27
- data/lib/ad_localize/parsers/csv_parser.rb +84 -0
- data/lib/ad_localize/parsers/key_parser.rb +62 -0
- data/lib/ad_localize/repositories/drive_repository.rb +53 -0
- data/lib/ad_localize/repositories/file_system_repository.rb +2 -1
- data/lib/ad_localize/requests/export_request.rb +95 -57
- data/lib/ad_localize/sanitizers/ios_sanitizer.rb +12 -0
- data/lib/ad_localize/{mappers/android_translation_mapper.rb → sanitizers/ios_to_android_sanitizer.rb} +8 -8
- data/lib/ad_localize/sanitizers/pass_through_sanitizer.rb +10 -0
- data/lib/ad_localize/serializers/info_plist_serializer.rb +9 -11
- data/lib/ad_localize/serializers/json_serializer.rb +3 -5
- data/lib/ad_localize/serializers/localizable_strings_serializer.rb +9 -15
- data/lib/ad_localize/serializers/localizable_stringsdict_serializer.rb +12 -25
- data/lib/ad_localize/serializers/properties_serializer.rb +9 -11
- data/lib/ad_localize/serializers/strings_serializer.rb +12 -21
- data/lib/ad_localize/serializers/templated_serializer.rb +51 -0
- data/lib/ad_localize/serializers/yaml_serializer.rb +4 -6
- data/lib/ad_localize/templates/android/strings.xml.erb +6 -6
- data/lib/ad_localize/templates/ios/Localizable.stringsdict.erb +14 -14
- data/lib/ad_localize/version.rb +2 -1
- data/lib/ad_localize/view_models/compound_wording_view_model.rb +2 -0
- data/lib/ad_localize/view_models/simple_wording_view_model.rb +2 -0
- data/lib/ad_localize.rb +33 -35
- metadata +70 -47
- data/lib/ad_localize/constant.rb +0 -6
- data/lib/ad_localize/entities/translation.rb +0 -32
- data/lib/ad_localize/entities/wording.rb +0 -24
- data/lib/ad_localize/interactors/execute_export_request.rb +0 -45
- data/lib/ad_localize/interactors/export_csv_files.rb +0 -20
- data/lib/ad_localize/interactors/export_g_spreadsheet.rb +0 -64
- data/lib/ad_localize/interactors/platforms/export_android_locale_wording.rb +0 -44
- data/lib/ad_localize/interactors/platforms/export_csv_locale_wording.rb +0 -22
- data/lib/ad_localize/interactors/platforms/export_ios_locale_wording.rb +0 -75
- data/lib/ad_localize/interactors/platforms/export_json_locale_wording.rb +0 -27
- data/lib/ad_localize/interactors/platforms/export_platform_factory.rb +0 -50
- data/lib/ad_localize/interactors/platforms/export_properties_locale_wording.rb +0 -32
- data/lib/ad_localize/interactors/platforms/export_yaml_locale_wording.rb +0 -27
- data/lib/ad_localize/mappers/csv_path_to_wording.rb +0 -73
- data/lib/ad_localize/mappers/ios_translation_mapper.rb +0 -12
- data/lib/ad_localize/mappers/translation_group_mapper.rb +0 -14
- data/lib/ad_localize/mappers/translation_mapper.rb +0 -30
- data/lib/ad_localize/mappers/value_range_to_wording.rb +0 -67
- data/lib/ad_localize/repositories/g_sheets_repository.rb +0 -44
- data/lib/ad_localize/requests/export_wording_options.rb +0 -24
- data/lib/ad_localize/requests/g_spreadsheet_options.rb +0 -47
- data/lib/ad_localize/requests/merge_policy.rb +0 -28
- data/lib/ad_localize/serializers/with_template.rb +0 -19
- data/lib/ad_localize/validators/key_validator.rb +0 -31
- data/lib/ad_localize/view_models/translation_group_view_model.rb +0 -19
- data/lib/ad_localize/view_models/translation_view_model.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c1c393dd716aa7f1306df1a86b7e166194efebe24d94e6f5c61628d62026a60
|
4
|
+
data.tar.gz: 4e1d02d8e92919e656c1fdb77efb620e9f5c812b4c59da5d6682269917886b00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a041906d4a7f138fc762be1dc4b30ef2b91fcb8419ad4a28c90c24689deb5eb684877671721156ff63c3044788116252789cd14bddefd968731625bb6766cb5
|
7
|
+
data.tar.gz: f9e3cc3ad69de48aa334471443a554562a2f9a7a47364737bfd5af6755dc5040eba68249dd37e9c5ae4445e7afd0e6259e5d97181c9feb4d4443696f2344bf36
|
data/.github/workflows/ruby.yml
CHANGED
@@ -7,15 +7,18 @@ jobs:
|
|
7
7
|
runs-on: ubuntu-latest
|
8
8
|
strategy:
|
9
9
|
matrix:
|
10
|
-
ruby: ['
|
10
|
+
ruby: ['3.0.6', '3.1.4', '3.2.0']
|
11
11
|
|
12
12
|
steps:
|
13
13
|
- uses: actions/checkout@v2
|
14
14
|
- uses: ruby/setup-ruby@v1
|
15
15
|
with:
|
16
16
|
ruby-version: ${{ matrix.ruby }}
|
17
|
-
- name: Build
|
17
|
+
- name: Build
|
18
18
|
run: |
|
19
19
|
gem install bundler
|
20
20
|
bundle install --jobs 4 --retry 3
|
21
|
-
|
21
|
+
- name: Run linter
|
22
|
+
run: bundle exec rubocop
|
23
|
+
- name: Run tests
|
24
|
+
run: bundle exec rake test
|
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,319 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2023-02-02 13:39:01 UTC using RuboCop version 1.43.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 4
|
10
|
+
# This cop supports safe autocorrection (--autocorrect).
|
11
|
+
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
|
12
|
+
# Include: **/*.gemspec
|
13
|
+
Gemspec/OrderedDependencies:
|
14
|
+
Exclude:
|
15
|
+
- 'ad_localize.gemspec'
|
16
|
+
|
17
|
+
# Offense count: 1
|
18
|
+
# Configuration parameters: Severity, Include.
|
19
|
+
# Include: **/*.gemspec
|
20
|
+
Gemspec/RequiredRubyVersion:
|
21
|
+
Exclude:
|
22
|
+
- 'ad_localize.gemspec'
|
23
|
+
|
24
|
+
# Offense count: 86
|
25
|
+
# This cop supports safe autocorrection (--autocorrect).
|
26
|
+
Layout/EmptyLineAfterMagicComment:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
# Offense count: 1
|
30
|
+
# This cop supports safe autocorrection (--autocorrect).
|
31
|
+
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
|
32
|
+
Lint/UnusedBlockArgument:
|
33
|
+
Exclude:
|
34
|
+
- 'lib/ad_localize/mappers/locale_wording_to_hash.rb'
|
35
|
+
|
36
|
+
# Offense count: 4
|
37
|
+
# This cop supports safe autocorrection (--autocorrect).
|
38
|
+
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
|
39
|
+
Lint/UnusedMethodArgument:
|
40
|
+
Exclude:
|
41
|
+
- 'lib/ad_localize/interactors/base_generate_files.rb'
|
42
|
+
- 'lib/ad_localize/serializers/templated_serializer.rb'
|
43
|
+
|
44
|
+
# Offense count: 6
|
45
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
|
46
|
+
Metrics/AbcSize:
|
47
|
+
Max: 35
|
48
|
+
|
49
|
+
# Offense count: 2
|
50
|
+
# Configuration parameters: CountComments, CountAsOne.
|
51
|
+
Metrics/ClassLength:
|
52
|
+
Max: 139
|
53
|
+
|
54
|
+
# Offense count: 1
|
55
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
|
56
|
+
Metrics/CyclomaticComplexity:
|
57
|
+
Max: 11
|
58
|
+
|
59
|
+
# Offense count: 11
|
60
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
61
|
+
Metrics/MethodLength:
|
62
|
+
Max: 40
|
63
|
+
|
64
|
+
# Offense count: 1
|
65
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
|
66
|
+
Metrics/PerceivedComplexity:
|
67
|
+
Max: 11
|
68
|
+
|
69
|
+
# Offense count: 1
|
70
|
+
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
71
|
+
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
|
72
|
+
Naming/MethodParameterName:
|
73
|
+
Exclude:
|
74
|
+
- 'lib/ad_localize/mappers/locale_wording_to_hash.rb'
|
75
|
+
|
76
|
+
# Offense count: 10
|
77
|
+
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
|
78
|
+
# NamePrefix: is_, has_, have_
|
79
|
+
# ForbiddenPrefixes: is_, has_, have_
|
80
|
+
# AllowedMethods: is_a?
|
81
|
+
# MethodDefinitionMacros: define_method, define_singleton_method
|
82
|
+
Naming/PredicateName:
|
83
|
+
Exclude:
|
84
|
+
- 'spec/**/*'
|
85
|
+
- 'lib/ad_localize/interactors/base_generate_files.rb'
|
86
|
+
- 'lib/ad_localize/interactors/generate_info_plist.rb'
|
87
|
+
- 'lib/ad_localize/interactors/generate_json.rb'
|
88
|
+
- 'lib/ad_localize/interactors/generate_localizable_strings.rb'
|
89
|
+
- 'lib/ad_localize/interactors/generate_localizable_strings_dict.rb'
|
90
|
+
- 'lib/ad_localize/interactors/generate_properties.rb'
|
91
|
+
- 'lib/ad_localize/interactors/generate_strings.rb'
|
92
|
+
- 'lib/ad_localize/interactors/generate_yaml.rb'
|
93
|
+
- 'lib/ad_localize/requests/export_request.rb'
|
94
|
+
|
95
|
+
# Offense count: 28
|
96
|
+
# Configuration parameters: EnforcedStyle, AllowedIdentifiers, AllowedPatterns.
|
97
|
+
# SupportedStyles: snake_case, camelCase
|
98
|
+
Naming/VariableName:
|
99
|
+
Exclude:
|
100
|
+
- 'lib/ad_localize/sanitizers/ios_to_android_sanitizer.rb'
|
101
|
+
|
102
|
+
# Offense count: 1
|
103
|
+
# This cop supports safe autocorrection (--autocorrect).
|
104
|
+
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, IgnoredMethods, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
|
105
|
+
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
|
106
|
+
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
107
|
+
# FunctionalMethods: let, let!, subject, watch
|
108
|
+
# AllowedMethods: lambda, proc, it
|
109
|
+
Style/BlockDelimiters:
|
110
|
+
Exclude:
|
111
|
+
- 'lib/ad_localize/parsers/csv_parser.rb'
|
112
|
+
|
113
|
+
# Offense count: 2
|
114
|
+
# This cop supports safe autocorrection (--autocorrect).
|
115
|
+
# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
|
116
|
+
# SupportedStyles: assign_to_condition, assign_inside_condition
|
117
|
+
Style/ConditionalAssignment:
|
118
|
+
Exclude:
|
119
|
+
- 'lib/ad_localize/interactors/export_wording.rb'
|
120
|
+
- 'lib/ad_localize/sanitizers/ios_to_android_sanitizer.rb'
|
121
|
+
|
122
|
+
# Offense count: 36
|
123
|
+
# Configuration parameters: AllowedConstants.
|
124
|
+
Style/Documentation:
|
125
|
+
Enabled: false
|
126
|
+
|
127
|
+
# Offense count: 3
|
128
|
+
# This cop supports safe autocorrection (--autocorrect).
|
129
|
+
Style/ExpandPathArguments:
|
130
|
+
Exclude:
|
131
|
+
- 'ad_localize.gemspec'
|
132
|
+
- 'test/test_helper.rb'
|
133
|
+
|
134
|
+
# Offense count: 3
|
135
|
+
# This cop supports safe autocorrection (--autocorrect).
|
136
|
+
# Configuration parameters: EnforcedStyle.
|
137
|
+
# SupportedStyles: format, sprintf, percent
|
138
|
+
Style/FormatString:
|
139
|
+
Exclude:
|
140
|
+
- 'lib/ad_localize/interactors/generate_info_plist.rb'
|
141
|
+
- 'lib/ad_localize/interactors/generate_localizable_strings.rb'
|
142
|
+
- 'lib/ad_localize/interactors/generate_localizable_strings_dict.rb'
|
143
|
+
|
144
|
+
# Offense count: 3
|
145
|
+
# This cop supports safe autocorrection (--autocorrect).
|
146
|
+
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
147
|
+
# SupportedStyles: annotated, template, unannotated
|
148
|
+
Style/FormatStringToken:
|
149
|
+
EnforcedStyle: template
|
150
|
+
|
151
|
+
# Offense count: 1
|
152
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
153
|
+
Style/GlobalStdStream:
|
154
|
+
Exclude:
|
155
|
+
- 'lib/ad_localize/ad_logger.rb'
|
156
|
+
|
157
|
+
# Offense count: 1
|
158
|
+
# This cop supports safe autocorrection (--autocorrect).
|
159
|
+
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
|
160
|
+
Style/GuardClause:
|
161
|
+
Exclude:
|
162
|
+
- 'lib/ad_localize/repositories/drive_repository.rb'
|
163
|
+
|
164
|
+
# Offense count: 57
|
165
|
+
# This cop supports safe autocorrection (--autocorrect).
|
166
|
+
# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
167
|
+
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
168
|
+
# SupportedShorthandSyntax: always, never, either, consistent
|
169
|
+
Style/HashSyntax:
|
170
|
+
Enabled: false
|
171
|
+
|
172
|
+
# Offense count: 4
|
173
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
174
|
+
Style/LineEndConcatenation:
|
175
|
+
Exclude:
|
176
|
+
- 'lib/ad_localize/entities/locale_wording.rb'
|
177
|
+
|
178
|
+
# Offense count: 6
|
179
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
180
|
+
# Configuration parameters: EnforcedStyle.
|
181
|
+
# SupportedStyles: literals, strict
|
182
|
+
Style/MutableConstant:
|
183
|
+
Exclude:
|
184
|
+
- 'lib/ad_localize/entities/platform.rb'
|
185
|
+
- 'lib/ad_localize/interactors/merge_wordings.rb'
|
186
|
+
- 'lib/ad_localize/option_handler.rb'
|
187
|
+
- 'lib/ad_localize/requests/export_request.rb'
|
188
|
+
- 'test/test_helper.rb'
|
189
|
+
|
190
|
+
# Offense count: 1
|
191
|
+
# This cop supports safe autocorrection (--autocorrect).
|
192
|
+
# Configuration parameters: EnforcedStyle.
|
193
|
+
# SupportedStyles: both, prefix, postfix
|
194
|
+
Style/NegatedIf:
|
195
|
+
Exclude:
|
196
|
+
- 'lib/ad_localize/interactors/generate_strings.rb'
|
197
|
+
|
198
|
+
# Offense count: 3
|
199
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
200
|
+
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
201
|
+
# SupportedStyles: predicate, comparison
|
202
|
+
Style/NumericPredicate:
|
203
|
+
Exclude:
|
204
|
+
- 'spec/**/*'
|
205
|
+
- 'test/interactors/process_export_request_test.rb'
|
206
|
+
- 'test/repositories/drive_repository_test.rb'
|
207
|
+
|
208
|
+
# Offense count: 1
|
209
|
+
# This cop supports safe autocorrection (--autocorrect).
|
210
|
+
# Configuration parameters: AllowedCompactTypes.
|
211
|
+
# SupportedStyles: compact, exploded
|
212
|
+
Style/RaiseArgs:
|
213
|
+
EnforcedStyle: compact
|
214
|
+
|
215
|
+
# Offense count: 1
|
216
|
+
# This cop supports safe autocorrection (--autocorrect).
|
217
|
+
Style/RedundantAssignment:
|
218
|
+
Exclude:
|
219
|
+
- 'lib/ad_localize/parsers/csv_parser.rb'
|
220
|
+
|
221
|
+
# Offense count: 1
|
222
|
+
# This cop supports safe autocorrection (--autocorrect).
|
223
|
+
Style/RedundantBegin:
|
224
|
+
Exclude:
|
225
|
+
- 'lib/ad_localize/repositories/drive_repository.rb'
|
226
|
+
|
227
|
+
# Offense count: 18
|
228
|
+
# This cop supports safe autocorrection (--autocorrect).
|
229
|
+
Style/RedundantFreeze:
|
230
|
+
Exclude:
|
231
|
+
- 'lib/ad_localize/interactors/generate_info_plist.rb'
|
232
|
+
- 'lib/ad_localize/interactors/generate_localizable_strings.rb'
|
233
|
+
- 'lib/ad_localize/interactors/generate_localizable_strings_dict.rb'
|
234
|
+
- 'lib/ad_localize/interactors/generate_strings.rb'
|
235
|
+
- 'lib/ad_localize/interactors/merge_wordings.rb'
|
236
|
+
- 'lib/ad_localize/parsers/csv_parser.rb'
|
237
|
+
- 'lib/ad_localize/parsers/key_parser.rb'
|
238
|
+
- 'lib/ad_localize/serializers/info_plist_serializer.rb'
|
239
|
+
- 'lib/ad_localize/serializers/localizable_strings_serializer.rb'
|
240
|
+
- 'lib/ad_localize/serializers/localizable_stringsdict_serializer.rb'
|
241
|
+
|
242
|
+
# Offense count: 2
|
243
|
+
# This cop supports safe autocorrection (--autocorrect).
|
244
|
+
Style/RedundantPercentQ:
|
245
|
+
Exclude:
|
246
|
+
- 'ad_localize.gemspec'
|
247
|
+
|
248
|
+
# Offense count: 2
|
249
|
+
# This cop supports safe autocorrection (--autocorrect).
|
250
|
+
Style/RedundantRegexpEscape:
|
251
|
+
Exclude:
|
252
|
+
- 'lib/ad_localize/sanitizers/ios_sanitizer.rb'
|
253
|
+
- 'lib/ad_localize/sanitizers/ios_to_android_sanitizer.rb'
|
254
|
+
|
255
|
+
# Offense count: 1
|
256
|
+
# This cop supports safe autocorrection (--autocorrect).
|
257
|
+
# Configuration parameters: AllowMultipleReturnValues.
|
258
|
+
Style/RedundantReturn:
|
259
|
+
Exclude:
|
260
|
+
- 'lib/ad_localize/option_handler.rb'
|
261
|
+
|
262
|
+
# Offense count: 2
|
263
|
+
# This cop supports safe autocorrection (--autocorrect).
|
264
|
+
# Configuration parameters: EnforcedStyle.
|
265
|
+
# SupportedStyles: implicit, explicit
|
266
|
+
Style/RescueStandardError:
|
267
|
+
Exclude:
|
268
|
+
- 'lib/ad_localize/repositories/drive_repository.rb'
|
269
|
+
|
270
|
+
# Offense count: 1
|
271
|
+
# This cop supports safe autocorrection (--autocorrect).
|
272
|
+
Style/SelfAssignment:
|
273
|
+
Exclude:
|
274
|
+
- 'lib/ad_localize/sanitizers/ios_to_android_sanitizer.rb'
|
275
|
+
|
276
|
+
# Offense count: 3
|
277
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
278
|
+
Style/SlicingWithRange:
|
279
|
+
Exclude:
|
280
|
+
- 'lib/ad_localize/interactors/merge_wordings.rb'
|
281
|
+
- 'lib/ad_localize/mappers/locale_wording_to_hash.rb'
|
282
|
+
- 'lib/ad_localize/parsers/csv_parser.rb'
|
283
|
+
|
284
|
+
# Offense count: 3
|
285
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
286
|
+
# Configuration parameters: Mode.
|
287
|
+
Style/StringConcatenation:
|
288
|
+
Exclude:
|
289
|
+
- 'lib/ad_localize/serializers/properties_serializer.rb'
|
290
|
+
- 'lib/ad_localize/serializers/strings_serializer.rb'
|
291
|
+
- 'lib/ad_localize/serializers/templated_serializer.rb'
|
292
|
+
|
293
|
+
# Offense count: 85
|
294
|
+
# This cop supports safe autocorrection (--autocorrect).
|
295
|
+
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
296
|
+
# SupportedStyles: single_quotes, double_quotes
|
297
|
+
Style/StringLiterals:
|
298
|
+
Enabled: false
|
299
|
+
|
300
|
+
# Offense count: 3
|
301
|
+
# This cop supports safe autocorrection (--autocorrect).
|
302
|
+
Style/SymbolLiteral:
|
303
|
+
Exclude:
|
304
|
+
- 'lib/ad_localize/mappers/options_to_export_request.rb'
|
305
|
+
- 'test/option_handler_test.rb'
|
306
|
+
|
307
|
+
# Offense count: 3
|
308
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
309
|
+
Style/ZeroLengthPredicate:
|
310
|
+
Exclude:
|
311
|
+
- 'lib/ad_localize/mappers/locale_wording_to_hash.rb'
|
312
|
+
- 'test/repositories/drive_repository_test.rb'
|
313
|
+
|
314
|
+
# Offense count: 10
|
315
|
+
# This cop supports safe autocorrection (--autocorrect).
|
316
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
|
317
|
+
# URISchemes: http, https
|
318
|
+
Layout/LineLength:
|
319
|
+
Max: 153
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,30 @@ 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
8
|
## Unreleased
|
9
|
+
### Added
|
10
|
+
|
11
|
+
- Remove extra spaces before and after key/translation contents
|
12
|
+
- skip lines starting with a `#` character
|
13
|
+
- new option `-l` or `--locales` to export only a subset or locales
|
14
|
+
- Separate csv parse responsibility between key parser and csv parser
|
15
|
+
- use Rubocop to detect coding style offenses (also in github workflow)
|
16
|
+
- print warning log when a value is replaced during merge
|
17
|
+
|
18
|
+
### Changed
|
19
|
+
|
20
|
+
- parse csv in 2 steps : first analyze keys and keep them in a map, second add translations to keys
|
21
|
+
- do not store empty values during parse if `-x` option is active
|
22
|
+
- handle duplicate keys while parsing csv instead of while exporting for a platform
|
23
|
+
- BREAKING CHANGE : the way to provide service account information is no longer to set GCLOUD_CLIENT_SECRET with the content of the service account configuration. Now you need to provide the path to the configuration using the environment variable GOOGLE_APPLICATION_CREDENTIALS
|
24
|
+
- we no longer access to spreadsheet cells using GSheet v4. Now we downloaded all the relevant sheets and then we parse file contents like normal csv files. We use the exponentiel retry feature provided by google with a maximum of 3 attempts [more info here](https://github.com/googleapis/google-api-ruby-client/blob/377edf2ca4c1ef41a91de4176e5c7ad7df220007/google-apis-core/lib/google/apis/options.rb#L70). We noticed we had download error for 6 or more sheets in a spreadsheet.
|
25
|
+
- locale wording stores separately each type of wording. This allows to export each wording type concurrently if you want to
|
26
|
+
- no more plaform interactor. It has been replaced with generated file interactors. We still have an ios interactor because there are multiple files to export.
|
27
|
+
- All templated serializers now share a common parent : `TemplatedSerializer`
|
28
|
+
- Isolate the process to ensure a translation is correctly formatted for a platform in a new class type `sanitizers`. They can be tested separately.
|
29
|
+
|
30
|
+
### Removed
|
31
|
+
|
32
|
+
- no more GSpreadsheetOptions. It is handled directly in request
|
9
33
|
|
10
34
|
## [5.0.0] - 2022-07-26
|
11
35
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,53 +1,37 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ad_localize (
|
4
|
+
ad_localize (6.0.0)
|
5
5
|
activesupport (>= 6.1.3.2, < 8.0)
|
6
6
|
colorize (~> 0.8)
|
7
|
+
google-apis-drive_v3 (~> 0.33.0)
|
7
8
|
google-apis-sheets_v4 (~> 0.9)
|
8
|
-
googleauth (~> 0.12)
|
9
|
-
nokogiri (~> 1.10)
|
10
9
|
|
11
10
|
GEM
|
12
11
|
remote: https://rubygems.org/
|
13
12
|
specs:
|
14
|
-
activesupport (7.0.
|
13
|
+
activesupport (7.0.4)
|
15
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
15
|
i18n (>= 1.6, < 2)
|
17
16
|
minitest (>= 5.1)
|
18
17
|
tzinfo (~> 2.0)
|
19
|
-
addressable (2.8.
|
20
|
-
public_suffix (>= 2.0.2, <
|
18
|
+
addressable (2.8.1)
|
19
|
+
public_suffix (>= 2.0.2, < 6.0)
|
21
20
|
ansi (1.5.0)
|
21
|
+
ast (2.4.2)
|
22
22
|
builder (3.2.4)
|
23
23
|
colorize (0.8.1)
|
24
24
|
concurrent-ruby (1.1.10)
|
25
|
+
debug (1.7.1)
|
26
|
+
irb (>= 1.5.0)
|
27
|
+
reline (>= 0.3.1)
|
25
28
|
declarative (0.0.20)
|
26
29
|
diffy (3.4.2)
|
27
|
-
faraday (
|
28
|
-
faraday-
|
29
|
-
faraday-em_synchrony (~> 1.0)
|
30
|
-
faraday-excon (~> 1.1)
|
31
|
-
faraday-httpclient (~> 1.0)
|
32
|
-
faraday-multipart (~> 1.0)
|
33
|
-
faraday-net_http (~> 1.0)
|
34
|
-
faraday-net_http_persistent (~> 1.0)
|
35
|
-
faraday-patron (~> 1.0)
|
36
|
-
faraday-rack (~> 1.0)
|
37
|
-
faraday-retry (~> 1.0)
|
30
|
+
faraday (2.7.2)
|
31
|
+
faraday-net_http (>= 2.0, < 3.1)
|
38
32
|
ruby2_keywords (>= 0.0.4)
|
39
|
-
faraday-
|
40
|
-
|
41
|
-
faraday-excon (1.1.0)
|
42
|
-
faraday-httpclient (1.0.1)
|
43
|
-
faraday-multipart (1.0.4)
|
44
|
-
multipart-post (~> 2)
|
45
|
-
faraday-net_http (1.0.1)
|
46
|
-
faraday-net_http_persistent (1.2.0)
|
47
|
-
faraday-patron (1.0.0)
|
48
|
-
faraday-rack (1.0.0)
|
49
|
-
faraday-retry (1.0.3)
|
50
|
-
google-apis-core (0.7.0)
|
33
|
+
faraday-net_http (3.0.2)
|
34
|
+
google-apis-core (0.9.4)
|
51
35
|
addressable (~> 2.5, >= 2.5.1)
|
52
36
|
googleauth (>= 0.16.2, < 2.a)
|
53
37
|
httpclient (>= 2.8.1, < 3.a)
|
@@ -56,44 +40,63 @@ GEM
|
|
56
40
|
retriable (>= 2.0, < 4.a)
|
57
41
|
rexml
|
58
42
|
webrick
|
59
|
-
google-apis-
|
60
|
-
google-apis-core (>= 0.
|
61
|
-
|
62
|
-
|
43
|
+
google-apis-drive_v3 (0.33.0)
|
44
|
+
google-apis-core (>= 0.9.1, < 2.a)
|
45
|
+
google-apis-sheets_v4 (0.21.0)
|
46
|
+
google-apis-core (>= 0.9.1, < 2.a)
|
47
|
+
googleauth (1.3.0)
|
48
|
+
faraday (>= 0.17.3, < 3.a)
|
63
49
|
jwt (>= 1.4, < 3.0)
|
64
50
|
memoist (~> 0.16)
|
65
51
|
multi_json (~> 1.11)
|
66
52
|
os (>= 0.9, < 2.0)
|
67
|
-
signet (
|
53
|
+
signet (>= 0.16, < 2.a)
|
68
54
|
httpclient (2.8.3)
|
69
55
|
i18n (1.12.0)
|
70
56
|
concurrent-ruby (~> 1.0)
|
71
|
-
|
57
|
+
io-console (0.6.0)
|
58
|
+
irb (1.6.2)
|
59
|
+
reline (>= 0.3.0)
|
60
|
+
json (2.6.3)
|
61
|
+
jwt (2.6.0)
|
72
62
|
memoist (0.16.2)
|
73
63
|
mini_mime (1.1.2)
|
74
|
-
|
75
|
-
minitest (5.
|
76
|
-
minitest-reporters (1.4.2)
|
64
|
+
minitest (5.17.0)
|
65
|
+
minitest-reporters (1.5.0)
|
77
66
|
ansi
|
78
67
|
builder
|
79
68
|
minitest (>= 5.0)
|
80
69
|
ruby-progressbar
|
81
70
|
multi_json (1.15.0)
|
82
|
-
multipart-post (2.2.3)
|
83
|
-
nokogiri (1.13.8)
|
84
|
-
mini_portile2 (~> 2.8.0)
|
85
|
-
racc (~> 1.4)
|
86
71
|
os (1.1.4)
|
87
|
-
|
88
|
-
|
89
|
-
|
72
|
+
parallel (1.22.1)
|
73
|
+
parser (3.2.0.0)
|
74
|
+
ast (~> 2.4.1)
|
75
|
+
public_suffix (5.0.1)
|
76
|
+
rainbow (3.1.1)
|
77
|
+
rake (13.0.6)
|
78
|
+
regexp_parser (2.6.1)
|
79
|
+
reline (0.3.2)
|
80
|
+
io-console (~> 0.5)
|
90
81
|
representable (3.2.0)
|
91
82
|
declarative (< 0.1.0)
|
92
83
|
trailblazer-option (>= 0.1.1, < 0.2.0)
|
93
84
|
uber (< 0.2.0)
|
94
85
|
retriable (3.1.2)
|
95
86
|
rexml (3.2.5)
|
96
|
-
|
87
|
+
rubocop (1.43.0)
|
88
|
+
json (~> 2.3)
|
89
|
+
parallel (~> 1.10)
|
90
|
+
parser (>= 3.2.0.0)
|
91
|
+
rainbow (>= 2.2.2, < 4.0)
|
92
|
+
regexp_parser (>= 1.8, < 3.0)
|
93
|
+
rexml (>= 3.2.5, < 4.0)
|
94
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
95
|
+
ruby-progressbar (~> 1.7)
|
96
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
97
|
+
rubocop-ast (1.24.1)
|
98
|
+
parser (>= 3.1.1.0)
|
99
|
+
ruby-progressbar (1.11.0)
|
97
100
|
ruby2_keywords (0.0.5)
|
98
101
|
signet (0.17.0)
|
99
102
|
addressable (~> 2.8)
|
@@ -104,18 +107,21 @@ GEM
|
|
104
107
|
tzinfo (2.0.5)
|
105
108
|
concurrent-ruby (~> 1.0)
|
106
109
|
uber (0.1.0)
|
110
|
+
unicode-display_width (2.4.2)
|
107
111
|
webrick (1.7.0)
|
108
112
|
|
109
113
|
PLATFORMS
|
110
|
-
|
114
|
+
arm64-darwin-21
|
111
115
|
|
112
116
|
DEPENDENCIES
|
113
117
|
ad_localize!
|
114
118
|
bundler (>= 1.12.0, < 3.0.0)
|
119
|
+
debug (>= 1.0.0, < 2.0)
|
115
120
|
diffy (~> 3.3)
|
116
121
|
minitest (~> 5.11)
|
117
122
|
minitest-reporters (~> 1.3)
|
118
123
|
rake (>= 12.3.0, < 14.0.0)
|
124
|
+
rubocop (~> 1.0)
|
119
125
|
|
120
126
|
BUNDLED WITH
|
121
|
-
2.
|
127
|
+
2.4.3
|
data/README.md
CHANGED
@@ -4,6 +4,11 @@ The purpose of this gem is to automatically generate wording files from a CSV in
|
|
4
4
|
It supports iOS, Android, JSON, YAML and Java Properties.
|
5
5
|
It is a useful tool when working on a mobile application or a SPA.
|
6
6
|
|
7
|
+
## Migration from 5.x to 6.0.0
|
8
|
+
|
9
|
+
When using the CLI replace `GCLOUD_CLIENT_SECRET=$(cat <path-to-client-secret.json>)` with `GOOGLE_APPLICATION_CREDENTIALS=<path-to-client-secret.json>`
|
10
|
+
When using the interactor refer to [ruby program usage section](###In-a-Ruby-program)
|
11
|
+
|
7
12
|
## Installation
|
8
13
|
|
9
14
|
Add this line to your application's Gemfile:
|
@@ -43,12 +48,12 @@ $ ad_localize -k <your-spreadsheet-drive-key> -s <comma-separated-sheet-id-list>
|
|
43
48
|
|
44
49
|
* Export wording from a private google spreadsheet. It requires a [Google Cloud Service Account](#using-a-google-cloud-service-account).
|
45
50
|
```
|
46
|
-
$
|
51
|
+
$ GOOGLE_APPLICATION_CREDENTIALS=<path-to-client-secret.json> ad_localize -k <your-spreadsheet-drive-key>
|
47
52
|
```
|
48
53
|
|
49
54
|
* Export wording from all sheets in a google spreadsheet. It requires a [Google Cloud Service Account](#using-a-google-cloud-service-account).
|
50
55
|
```
|
51
|
-
$
|
56
|
+
$ GOOGLE_APPLICATION_CREDENTIALS=<path-to-client-secret.json> ad_localize -k <your-spreadsheet-drive-key> -e
|
52
57
|
```
|
53
58
|
|
54
59
|
* Only generate wording files for the specified platforms
|
@@ -71,6 +76,11 @@ $ ad_localize -d
|
|
71
76
|
$ ad_localize -x
|
72
77
|
```
|
73
78
|
|
79
|
+
* Only generate wording files for the specified locales
|
80
|
+
```
|
81
|
+
$ ad_localize -l fr,en
|
82
|
+
```
|
83
|
+
|
74
84
|
### In a Ruby program
|
75
85
|
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.
|
76
86
|
|
@@ -79,12 +89,22 @@ If you want more examples, please open a documentation issue.
|
|
79
89
|
|
80
90
|
```Ruby
|
81
91
|
require 'ad_localize'
|
82
|
-
# create optional google spreasheet options
|
83
|
-
g_spreadsheet_options = AdLocalize::Requests::GSpreadsheetOptions.new(spreadsheet_id: 'some_id', sheet_ids: ['first', 'second'], service_account_config: ENV['GCLOUD_CLIENT_SECRET'])
|
84
92
|
# create export request
|
85
|
-
export_request =
|
86
|
-
|
87
|
-
|
93
|
+
export_request = Requests::ExportRequest.new
|
94
|
+
export_request.spreadsheet_id = 'some_id'
|
95
|
+
export_request.sheet_ids = %w[first second]
|
96
|
+
export_request.verbose = true
|
97
|
+
begin
|
98
|
+
# download files - be sure that GOOGLE_APPLICATION_CREDENTIALS is set if you use service account
|
99
|
+
export_request.downloaded_csvs = DownloadSpreadsheets.new.call(export_request: export_request)
|
100
|
+
# execute request
|
101
|
+
AdLocalize::Interactors::ExecuteExportRequest.new.call(export_request: export_request)
|
102
|
+
ensure
|
103
|
+
export_request.downloaded_csvs.each do |file|
|
104
|
+
file.close
|
105
|
+
file.unlink
|
106
|
+
end
|
107
|
+
end
|
88
108
|
```
|
89
109
|
|
90
110
|
## Accessing a google spreadsheet
|
@@ -106,12 +126,12 @@ To use a private google spreasheet you need to use a Google Cloud Service Accoun
|
|
106
126
|
- In *IAM & Admin / Service Account*, the service account's email is listed. Invite it to the spreadsheet to export.
|
107
127
|
|
108
128
|
```
|
109
|
-
$
|
110
|
-
$
|
129
|
+
$ GOOGLE_APPLICATION_CREDENTIALS=<path-to-client-secrets> ad_localize -k # one way
|
130
|
+
$ GOOGLE_APPLICATION_CREDENTIALS=<path-to-client-secrets> ad_localize -k <your-spreadsheet-drive-key> -s <comma-separated-sheet-id-list> # another way
|
111
131
|
```
|
112
132
|
|
113
133
|
```
|
114
|
-
$ export
|
134
|
+
$ export GOOGLE_APPLICATION_CREDENTIALS=<path-to-client-secrets>
|
115
135
|
$ ad_localize -k <your-spreadsheet-drive-key> # one way
|
116
136
|
$ ad_localize -k <your-spreadsheet-drive-key> -s <comma-separated-sheet-id-list> # another way
|
117
137
|
```
|
@@ -121,6 +141,7 @@ $ ad_localize -k <your-spreadsheet-drive-key> -s <comma-separated-sheet-id-list>
|
|
121
141
|
|
122
142
|
| key | fr | en |
|
123
143
|
| --- | --- | --- |
|
144
|
+
| # General | | |
|
124
145
|
| agenda | agenda | events |
|
125
146
|
| favorites | Mes favoris | My favorites |
|
126
147
|
| from_to | du %1$@ au %2$@ | from %1$@ to %2$@ |
|
@@ -129,6 +150,7 @@ $ ad_localize -k <your-spreadsheet-drive-key> -s <comma-separated-sheet-id-list>
|
|
129
150
|
- Keys should contain only letter, number, underscore and dot : [a-z0-9_.]+.
|
130
151
|
- Format specifiers must be numeroted if there are more than one in a translation string (eg: `"%1$@ %2$@'s report"`).
|
131
152
|
- _Only for Android_ keys without translation won't be considered
|
153
|
+
- Lines starting with a comment will be ignored
|
132
154
|
|
133
155
|
### Comments
|
134
156
|
|
data/Rakefile
CHANGED