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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b22e022079868b0d53fef06e6ff5b01dcaead0581e83717129bdcd7390b052c9
4
- data.tar.gz: 88132ad55d9464db0d5ada804264839d7229f47d30e2960ced17a16e198be63d
3
+ metadata.gz: a4c06e241d0980a1a3a3aff952368374d48828fda9ce5f4c25dcdf0575dab782
4
+ data.tar.gz: d5b6c18c75cbab4af8049a4c4eef1271786726a03dbd10ed468f9fc7e8f9b93e
5
5
  SHA512:
6
- metadata.gz: d3ee1b5e7edfbbb85e954d76670eb11fef58c78e364fff488802cf2adbcaec9be9712cf28751025cfb57dbd3f82f71d84cdd0a015080ecd2d4fdaec0226a6dc9
7
- data.tar.gz: c3436392abd8892303c3708ffc9bd54e140f1bd7d461b62bca4a12a6722781341458ce7257f4457d234633dc785e3185da23eef57fefeff9d43c65334db2dd66
6
+ metadata.gz: 2ab48e5f2b9e794efc34a17f10be561c45427d63bf4ca2e65c39da6c5491a3692139b2db0fbcba9b9398873945c41e8b814b4001f275f433ee4c80c48f0b5d09
7
+ data.tar.gz: 2729a5b80c06c3065e339520be25d4afabc1a7ab37ac5e502ed1701d9b85d9ba13dfd3289b2c858b847e99e5e2f17890a6c80f69f29c9cdd1969069dea627c7f
@@ -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
- # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
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@v3
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.yaml@main
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
- 2.7.6
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
@@ -63,4 +63,4 @@ Read [why we architected RTM in this way](https://docs.google.com/document/d/1ba
63
63
 
64
64
  ## Licence
65
65
 
66
- [MIT License](LICENSE.txt)
66
+ [MIT License](LICENCE)
@@ -1,25 +1,24 @@
1
1
  # Adding a language's plural form
2
2
 
3
- We maintain our own [plurals.rb](https://github.com/alphagov/rails_translation_manager/blob/master/config/locales/plurals.rb) configuration file. If adding a language to Rails Translation Manager, that doesn't exist in [rails-i18n](https://github.com/svenfuchs/rails-i18n), you may need to edit this file.
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
- This config is needed to correctly distinguish the [plural rules](https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html) for locales not included in `rails-i18n`, as it is needed for plural validation checks.
6
-
7
- Note that there is currently a [duplicate list in `govuk_app_config](https://github.com/alphagov/govuk_app_config/blob/main/lib/govuk_app_config/govuk_i18n.rb). The intention is for this to be removed and for the Rails Translation Manager version to be the sole version.
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 '' '/^ \+one:/d' config/locales/xx.yml
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\1nmany:\n\1other:/g' config/locales/xx.yml
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
- This commonly occurs for Slavic languages and Arabic, for example, which have plural forms other than just `:one` and `:other`.
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
- Sometimes RTM might remove keys that actually _are_ used by your application. This happens when the keys are referenced dynamically. You can make RTM ignore these keys by creating a `/config/i18n-tasks.yml` file with an `ignore_unused` key. For example:
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.exists?(language_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)
@@ -1,3 +1,3 @@
1
1
  module RailsTranslationManager
2
- VERSION = "1.6.3"
2
+ VERSION = "1.8.0"
3
3
  end
@@ -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
- assert_equal nil, data["language_names.es"], "language key for spanish should not be present"
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$/, File.readlines(output_file).last
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.6.3
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: 2022-12-07 00:00:00.000000000 Z
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
- - LICENSE.txt
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: '0'
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.3.26
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:
File without changes