danger-localizationlinter 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +33 -22
- data/ext/localizationlinter/localizationlinter.rb +6 -4
- data/lib/localizationlinter/gem_version.rb +1 -1
- data/lib/localizationlinter/plugin.rb +9 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ceb9d92872f544b3fa2e93706e8db77f41768087dd5e0d1fa8b8f21c007fa8ea
|
4
|
+
data.tar.gz: ec9b6d88a7eb6c451ee786c504efdb626216db6fb91926f7aafe9f27c56f2125
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9fac08ecfc14db788cab6691d4b38d1bd246a2d5590d6a718cc0ba4f4646158f949d64154d4a1753f6253509efad3780ffbbc595bc4c91bbd50af86e38bb8c5
|
7
|
+
data.tar.gz: 4c15c67551e1538273f46f126723631875e016c96f78fb21dffdebda63800ae1d563275877cd650fb484f170424d64190b59de3aa3e2590485924491975fa748
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
### localizationlinter
|
2
2
|
|
3
3
|
Verify consistency over your project localizable files (localizable.strings and Localizable.stringdict)
|
4
4
|
It uses Swiftgen to generate a localizables output per target and language and compare the output with
|
@@ -8,15 +8,11 @@ Verify consistency over your project localizable files (localizable.strings and
|
|
8
8
|
- additional keys
|
9
9
|
- wrong parameters in string format
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
<blockquote>Verify my project localizables consistency
|
12
|
+
<pre>localizationlinter.lint</pre>
|
13
|
+
</blockquote>
|
14
14
|
|
15
|
-
## Usage
|
16
15
|
|
17
|
-
Methods and attributes from this plugin are available in your `Dangerfile` under the `localizationlinter` namespace.
|
18
|
-
|
19
|
-
localizationlinter.lint
|
20
16
|
|
21
17
|
#### Attributes
|
22
18
|
|
@@ -27,11 +23,13 @@ Methods and attributes from this plugin are available in your `Dangerfile` under
|
|
27
23
|
`verbose` - Print execution logs
|
28
24
|
|
29
25
|
`language_configuration_path` - Path to language configuration yml, defining main language per target
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
26
|
+
example:
|
27
|
+
```yml
|
28
|
+
My_target: en
|
29
|
+
My_other_target: fr
|
30
|
+
```
|
31
|
+
Default value is `Configuration/Defaults/all_target_main_language.yml`
|
32
|
+
If no file is provided, the default language for each target is `en`
|
35
33
|
|
36
34
|
`swift_gen_path` - Path to swift gen, default value is Pods/SwiftGen/bin/swiftgen
|
37
35
|
|
@@ -41,6 +39,9 @@ default value is Configuration/Defaults/all_target_main_language.yml
|
|
41
39
|
|
42
40
|
`project_path` - Path to xcode project, default is taking the first project in root folder
|
43
41
|
|
42
|
+
|
43
|
+
|
44
|
+
|
44
45
|
#### Methods
|
45
46
|
|
46
47
|
`lint` - Verify the localizable files integrity over the project
|
@@ -48,15 +49,25 @@ rubocop:disable Metrics/MethodLength
|
|
48
49
|
|
49
50
|
`linter` - Returns the object in charge of verification
|
50
51
|
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
## Installation
|
56
|
+
|
57
|
+
$ gem install danger-localizationlinter
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
51
62
|
## Development
|
52
63
|
|
53
|
-
1. Clone this repo
|
54
|
-
2. Run `bundle install` to setup dependencies.
|
55
|
-
3. Run `bundle exec rake spec` to run the tests.
|
56
|
-
4. Use `bundle exec guard` to automatically have tests run as you make changes.
|
57
|
-
5. Make your changes.
|
64
|
+
1. Clone this repo
|
65
|
+
2. Run `bundle install` to setup dependencies.
|
66
|
+
3. Run `bundle exec rake spec` to run the tests.
|
67
|
+
4. Use `bundle exec guard` to automatically have tests run as you make changes.
|
68
|
+
5. Make your changes.
|
58
69
|
|
59
|
-
To update swiftgen bin, use Test project in `spec`:
|
60
|
-
1. `cd spec/Test`
|
61
|
-
2. Open Podfile and update SwiftGen version
|
62
|
-
3. `pod update SwiftGen`
|
70
|
+
To update swiftgen bin, use Test project in `spec`:
|
71
|
+
1. `cd spec/Test`
|
72
|
+
2. Open Podfile and update SwiftGen version
|
73
|
+
3. `pod update SwiftGen`
|
@@ -177,12 +177,14 @@ class LocalizationLinter
|
|
177
177
|
|
178
178
|
def main_region_for_target(target)
|
179
179
|
path = language_configuration_path
|
180
|
-
|
181
|
-
|
180
|
+
unless File.exist?(path)
|
181
|
+
log "Language configuration file not found, selecting default region 'en' for #{target}"
|
182
|
+
return 'en'
|
183
|
+
end
|
182
184
|
languages = YAML.safe_load(File.read(path)) || {}
|
183
185
|
unless languages[target]
|
184
|
-
log "
|
185
|
-
return
|
186
|
+
log "Language configuration file not found, selecting default region 'en' for #{target}"
|
187
|
+
return 'en'
|
186
188
|
end
|
187
189
|
|
188
190
|
languages[target]
|
@@ -12,12 +12,11 @@ module Danger
|
|
12
12
|
# - wrong parameters in string format
|
13
13
|
#
|
14
14
|
# @example Verify my project localizables consistency
|
15
|
-
#
|
16
15
|
# localizationlinter.lint
|
17
16
|
#
|
18
17
|
# @see https://github.com/fabernovel/danger-localizationlinter
|
19
18
|
# @tags iOS, Localization
|
20
|
-
|
19
|
+
|
21
20
|
class DangerLocalizationlinter < Plugin
|
22
21
|
# Keep or clean derived data after execution
|
23
22
|
# @return [void]
|
@@ -33,11 +32,12 @@ module Danger
|
|
33
32
|
|
34
33
|
# Path to language configuration yml, defining main language per target
|
35
34
|
# example:
|
36
|
-
|
35
|
+
#```yml
|
37
36
|
# My_target: en
|
38
37
|
# My_other_target: fr
|
39
|
-
|
40
|
-
#
|
38
|
+
#```
|
39
|
+
# Default value is `Configuration/Defaults/all_target_main_language.yml`
|
40
|
+
# If no file is provided, the default language for each target is `en`
|
41
41
|
# @return [void]
|
42
42
|
attr_accessor :language_configuration_path
|
43
43
|
|
@@ -62,7 +62,9 @@ module Danger
|
|
62
62
|
# rubocop:disable Metrics/MethodLength
|
63
63
|
def lint
|
64
64
|
differences = linter.find_differences
|
65
|
-
if
|
65
|
+
if differences.empty?
|
66
|
+
message "Localization Linter finished with no error"
|
67
|
+
elsif inline_mode
|
66
68
|
differences.each do |issue|
|
67
69
|
warn(
|
68
70
|
issue[:message],
|
@@ -70,7 +72,7 @@ module Danger
|
|
70
72
|
line: issue[:line]
|
71
73
|
)
|
72
74
|
end
|
73
|
-
|
75
|
+
else
|
74
76
|
message = differences.map do |difference|
|
75
77
|
"#{difference[:filename]}:#{difference[:line]} #{difference[:message]}"
|
76
78
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-localizationlinter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabernovel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|