rails_translation_manager 1.6.3 → 1.8.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 +8 -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
- data/test/rails_translation_manager/exporter_test.rb +1 -1
- data/test/rails_translation_manager/yaml_writer_test.rb +1 -1
- metadata +5 -8
- /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: a4c06e241d0980a1a3a3aff952368374d48828fda9ce5f4c25dcdf0575dab782
|
4
|
+
data.tar.gz: d5b6c18c75cbab4af8049a4c4eef1271786726a03dbd10ed468f9fc7e8f9b93e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ab48e5f2b9e794efc34a17f10be561c45427d63bf4ca2e65c39da6c5491a3692139b2db0fbcba9b9398873945c41e8b814b4001f275f433ee4c80c48f0b5d09
|
7
|
+
data.tar.gz: 2729a5b80c06c3065e339520be25d4afabc1a7ab37ac5e502ed1701d9b85d9ba13dfd3289b2c858b847e99e5e2f17890a6c80f69f29c9cdd1969069dea627c7f
|
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.2, 3.3]
|
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.3.6
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# 1.8.0
|
2
|
+
|
3
|
+
* Drop support for Ruby 3.1, keep supporting Ruby 3.2, use Ruby 3.3 as default https://github.com/alphagov/rails_translation_manager/pull/78
|
4
|
+
|
5
|
+
# 1.7.0
|
6
|
+
|
7
|
+
* Drop support for Ruby 3.0
|
8
|
+
|
1
9
|
# 1.6.3
|
2
10
|
|
3
11
|
* Use proc for single plural languages https://github.com/alphagov/rails_translation_manager/pull/62
|
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.2"
|
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)/})
|
@@ -95,7 +95,7 @@ module RailsTranslationManager
|
|
95
95
|
|
96
96
|
data = read_csv_data(exported_file("fr.csv"))
|
97
97
|
assert_equal ["French", nil], data["language_names.fr"]
|
98
|
-
|
98
|
+
assert_nil data["language_names.es"], "language key for spanish should not be present"
|
99
99
|
end
|
100
100
|
|
101
101
|
test 'should export correct pluralization forms for target' do
|
@@ -35,7 +35,7 @@ module RailsTranslationManager
|
|
35
35
|
|
36
36
|
DummyWriter.new.write_yaml(output_file, data)
|
37
37
|
|
38
|
-
assert_match /\n
|
38
|
+
assert_match (/\n$/), File.readlines(output_file).last
|
39
39
|
end
|
40
40
|
|
41
41
|
test 'strips whitespace from the end of lines for consistency with code editors' do
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
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.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2024-12-27 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: activesupport
|
@@ -163,7 +162,7 @@ files:
|
|
163
162
|
- ".ruby-version"
|
164
163
|
- CHANGELOG.md
|
165
164
|
- Gemfile
|
166
|
-
-
|
165
|
+
- LICENCE
|
167
166
|
- README.md
|
168
167
|
- Rakefile
|
169
168
|
- config/locales/plurals.rb
|
@@ -221,7 +220,6 @@ homepage: ''
|
|
221
220
|
licenses:
|
222
221
|
- MIT
|
223
222
|
metadata: {}
|
224
|
-
post_install_message:
|
225
223
|
rdoc_options: []
|
226
224
|
require_paths:
|
227
225
|
- lib
|
@@ -229,15 +227,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
229
227
|
requirements:
|
230
228
|
- - ">="
|
231
229
|
- !ruby/object:Gem::Version
|
232
|
-
version: '
|
230
|
+
version: '3.2'
|
233
231
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
234
232
|
requirements:
|
235
233
|
- - ">="
|
236
234
|
- !ruby/object:Gem::Version
|
237
235
|
version: '0'
|
238
236
|
requirements: []
|
239
|
-
rubygems_version: 3.
|
240
|
-
signing_key:
|
237
|
+
rubygems_version: 3.6.2
|
241
238
|
specification_version: 4
|
242
239
|
summary: Tasks to manage translation files
|
243
240
|
test_files:
|
/data/{LICENSE.txt → LICENCE}
RENAMED
File without changes
|