rails_translation_manager 1.6.3 → 1.7.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/ci.yml +13 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/docs/adding-editing-plural-forms.md +10 -9
- data/docs/rake-command-reference.md +11 -1
- data/lib/rails_translation_manager/importer.rb +1 -1
- data/lib/rails_translation_manager/version.rb +1 -1
- data/rails_translation_manager.gemspec +1 -0
- metadata +5 -5
- /data/{LICENSE.txt → LICENCE} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35e6ce2ef271522ff8d6d774923858bbd86682b5cb9cf5943c7e437346e5dd72
|
4
|
+
data.tar.gz: 054d264a3955fd7030b4ae7a786f487607c5d1665fb3fb711155226ed5552a99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d8427543085ed1c6da6934ba5222666493e92e7f6ef7428aeb63190eaa5e52c207f80bed995447b87d2871b1a1713759be95fa48692051655c01c6a65403529
|
7
|
+
data.tar.gz: 407c5222bbe5de884bf9e079dd460e86b7bb3cd667ef6ed6d2b181fb2a0e69d1296ac8e8ae889916308f8f047f225a88b39e686c591def63c9ee97eb6f7511d9
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,16 +1,25 @@
|
|
1
1
|
on: [push, pull_request]
|
2
2
|
|
3
3
|
jobs:
|
4
|
+
codeql-sast:
|
5
|
+
name: CodeQL SAST scan
|
6
|
+
uses: alphagov/govuk-infrastructure/.github/workflows/codeql-analysis.yml@main
|
7
|
+
permissions:
|
8
|
+
security-events: write
|
9
|
+
|
10
|
+
dependency-review:
|
11
|
+
name: Dependency Review scan
|
12
|
+
uses: alphagov/govuk-infrastructure/.github/workflows/dependency-review.yml@main
|
13
|
+
|
4
14
|
# This matrix job runs the test suite against multiple Ruby versions
|
5
15
|
test_matrix:
|
6
16
|
strategy:
|
7
17
|
fail-fast: false
|
8
18
|
matrix:
|
9
|
-
|
10
|
-
ruby: [ 2.7, '3.0', 3.1 ]
|
19
|
+
ruby: [3.1, 3.2]
|
11
20
|
runs-on: ubuntu-latest
|
12
21
|
steps:
|
13
|
-
- uses: actions/checkout@
|
22
|
+
- uses: actions/checkout@v4
|
14
23
|
- uses: ruby/setup-ruby@v1
|
15
24
|
with:
|
16
25
|
ruby-version: ${{ matrix.ruby }}
|
@@ -31,6 +40,6 @@ jobs:
|
|
31
40
|
if: ${{ github.ref == 'refs/heads/main' }}
|
32
41
|
permissions:
|
33
42
|
contents: write
|
34
|
-
uses: alphagov/govuk-infrastructure/.github/workflows/publish-rubygem.
|
43
|
+
uses: alphagov/govuk-infrastructure/.github/workflows/publish-rubygem.yml@main
|
35
44
|
secrets:
|
36
45
|
GEM_HOST_API_KEY: ${{ secrets.ALPHAGOV_RUBYGEMS_API_KEY }}
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.1.5
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,25 +1,24 @@
|
|
1
1
|
# Adding a language's plural form
|
2
2
|
|
3
|
-
We maintain our own [plurals.rb]
|
3
|
+
We maintain our own [plurals.rb][1] configuration file. This is used for plural
|
4
|
+
rules that don't exist in [rails-i18n][2].
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
If there is a missing plural rule (fails plural validator) then we can add the
|
7
|
+
rule to our [plurals.rb][1] file. Plural rules for most languages can be found
|
8
|
+
on the [unicode website][3] (cardinal type).
|
8
9
|
|
9
10
|
## Editing plural forms
|
10
11
|
|
11
12
|
Keys with incorrect plural forms are more complex to adjust. If there are keys with additional unnecessary plural forms, they can be deleted:
|
12
13
|
|
13
14
|
```
|
14
|
-
sed -i '' '/^
|
15
|
+
sed -i '' '/^ *one:/d' config/locales/xx.yml
|
15
16
|
```
|
16
17
|
|
17
|
-
This commonly occurs for e.g. Chinese and Vietnamese which are expected to have only an `:other` and not a `:one` form.
|
18
|
-
|
19
18
|
Keys which need a plural form added can be automated with caution. If every key of a specific translation needs the new plural added, it can be done by adding a blank key before every `other:` key:
|
20
19
|
|
21
20
|
```
|
22
|
-
perl -0777 -p -i -e 's/\n(\s+)other:/\n\
|
21
|
+
perl -0777 -p -i -e 's/\n(\s+)other:/\n\1many:\n\1other:/g' config/locales/xx.yml
|
23
22
|
```
|
24
23
|
|
25
24
|
Or if only a specific key needs the plural added:
|
@@ -28,4 +27,6 @@ Or if only a specific key needs the plural added:
|
|
28
27
|
perl -0777 -p -i -e 's/(key_with_missing_plural:\n)(\s+)/\1\2zero:\n\2/g' config/locales/xx.yml
|
29
28
|
```
|
30
29
|
|
31
|
-
|
30
|
+
[1]: https://github.com/alphagov/rails_translation_manager/blob/main/config/locales/plurals.rb
|
31
|
+
[2]: https://github.com/svenfuchs/rails-i18n
|
32
|
+
[3]: https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/language_plural_rules.html
|
@@ -42,11 +42,21 @@ rake translation:normalize
|
|
42
42
|
|
43
43
|
Remove keys that are not used anywhere in your application:
|
44
44
|
|
45
|
+
**Warning**:
|
46
|
+
> Removing unused keys may remove keys that actually _are_ used by your
|
47
|
+
application. This happens when RTM fails to scan certain keys in the
|
48
|
+
codebase, e.g when the keys are referenced dynamically. You can make RTM
|
49
|
+
ignore these keys by creating a `/config/i18n-tasks.yml` file with an
|
50
|
+
`ignore_unused` key.
|
51
|
+
|
52
|
+
A safer way to remove known unused keys is to use the [Delete keys](https://github.com/glebm/i18n-tasks#delete-keys)
|
53
|
+
command.
|
54
|
+
|
45
55
|
```
|
46
56
|
rake translation:remove_unused
|
47
57
|
```
|
48
58
|
|
49
|
-
|
59
|
+
Example `ignore_unused` config:
|
50
60
|
|
51
61
|
```yaml
|
52
62
|
ignore_unused:
|
@@ -73,7 +73,7 @@ class RailsTranslationManager::Importer
|
|
73
73
|
group_csv_by_file(csv).each do |group|
|
74
74
|
language_dir = File.join(import_directory, locale)
|
75
75
|
|
76
|
-
Dir.mkdir(language_dir) unless Dir.
|
76
|
+
Dir.mkdir(language_dir) unless Dir.exist?(language_dir)
|
77
77
|
|
78
78
|
import_yml_path = File.join(import_directory, locale, "#{group[0]}.yml")
|
79
79
|
import_csv(group[1], import_yml_path)
|
@@ -13,6 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.homepage = ""
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
|
+
spec.required_ruby_version = ">= 3.1"
|
16
17
|
spec.files = `git ls-files -z`.split("\x0")
|
17
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_translation_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -163,7 +163,7 @@ files:
|
|
163
163
|
- ".ruby-version"
|
164
164
|
- CHANGELOG.md
|
165
165
|
- Gemfile
|
166
|
-
-
|
166
|
+
- LICENCE
|
167
167
|
- README.md
|
168
168
|
- Rakefile
|
169
169
|
- config/locales/plurals.rb
|
@@ -229,14 +229,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
229
229
|
requirements:
|
230
230
|
- - ">="
|
231
231
|
- !ruby/object:Gem::Version
|
232
|
-
version: '
|
232
|
+
version: '3.1'
|
233
233
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
234
234
|
requirements:
|
235
235
|
- - ">="
|
236
236
|
- !ruby/object:Gem::Version
|
237
237
|
version: '0'
|
238
238
|
requirements: []
|
239
|
-
rubygems_version: 3.
|
239
|
+
rubygems_version: 3.5.11
|
240
240
|
signing_key:
|
241
241
|
specification_version: 4
|
242
242
|
summary: Tasks to manage translation files
|
/data/{LICENSE.txt → LICENCE}
RENAMED
File without changes
|