govuk_app_config 2.8.4 → 2.9.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: 33e68122dc749c8469335b186722c24e478858c06e336d7ee800f6ab123b4976
4
- data.tar.gz: fd63ff5feb1c2351d501d979dc22cff55ae8a09d3399d1c06ae45f2cfbaa11a8
3
+ metadata.gz: 106a5c63b04c2882b7715da357f9c2e6d69dd87c20f7ceccefdb8b1b7a27e0b7
4
+ data.tar.gz: 0035b7c017727795f9dcc2f99c883be9b0f8c0f77992ffd14f9373a16f890e31
5
5
  SHA512:
6
- metadata.gz: 474d4e1c5cfb393875e0347c24a201017923dfd5f327b4d95563d2d1a791e45aae4d9094a3b44dc2dd1493bb4ce519f4146b2159b88efb3b4a4f5520eb2eed3e
7
- data.tar.gz: d1dceb6b4dc58280cb84a73771c95cb2ec9e7c37b11cd66d8594e49b23b4d396dce0ee07a1f074a32b00bde6b49f5d8b921a8f6a3f3507787376420d19e5f263
6
+ metadata.gz: 7e80717eb6c207a69f25019806a2085c93ea595126d665314a54acc3679a4053db88a7062efb3b711b4368b5937dadc784af50532e3c9be30ab2310878842a44
7
+ data.tar.gz: 568071152636585876ece594c91884ebbce3d5a284ed4df8d9e268af05836e95872f7cc84e9f6ed73b672f61a6e20284274c7fe4fb45114728efc05a15b1ebba
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 2.9.0
2
+
3
+ * Add GovukI18n module with custom plural rules ([##187](https://github.com/alphagov/govuk_app_config/pull/187))
4
+
1
5
  # 2.8.4
2
6
 
3
7
  * Ensure Redis healthcheck avoids potential race condition ([#185](https://github.com/alphagov/govuk_app_config/pull/185))
data/README.md CHANGED
@@ -162,6 +162,10 @@ app with the following content:
162
162
  GovukContentSecurityPolicy.configure
163
163
  ```
164
164
 
165
+ ## i18n rules
166
+
167
+ Some frontend apps support languages that are not defined in the i18n gem. This provides them with our own custom rules for these languages.
168
+
165
169
  ## License
166
170
 
167
171
  [MIT License](LICENSE.md)
@@ -3,6 +3,7 @@ require "govuk_app_config/govuk_statsd"
3
3
  require "govuk_app_config/govuk_error"
4
4
  require "govuk_app_config/govuk_error/configure"
5
5
  require "govuk_app_config/govuk_healthcheck"
6
+ require "govuk_app_config/govuk_i18n"
6
7
  # This require is deprecated and should be removed on next major version bump
7
8
  # and should be required by applications directly.
8
9
  require "govuk_app_config/govuk_unicorn"
@@ -0,0 +1,38 @@
1
+ module GovukI18n
2
+ def plurals
3
+ {
4
+ # Dari - this isn't an iso code. Probably should be 'prs' as per ISO 639-3.
5
+ dr: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
6
+ # Latin America and Caribbean Spanish
7
+ "es-419": { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
8
+ # Scottish Gaelic
9
+ gd: { i18n: { plural: { keys: %i[one two few other],
10
+ rule:
11
+ lambda do |n|
12
+ if [1, 11].include?(n)
13
+ :one
14
+ elsif [2, 12].include?(n)
15
+ :two
16
+ elsif [3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 19].include?(n)
17
+ :few
18
+ else
19
+ :other
20
+ end
21
+ end } } },
22
+ # Armenian
23
+ hy: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
24
+ # Kazakh
25
+ kk: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
26
+ # Punjabi Shahmukhi
27
+ "pa-pk": { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
28
+ # Sinhalese
29
+ si: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
30
+ # Uzbek
31
+ uz: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
32
+ # Chinese Hong Kong
33
+ "zh-hk" => { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
34
+ # Chinese Taiwan
35
+ "zh-tw" => { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
36
+ }
37
+ end
38
+ end
@@ -1,3 +1,3 @@
1
1
  module GovukAppConfig
2
- VERSION = "2.8.4".freeze
2
+ VERSION = "2.9.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_app_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.4
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-18 00:00:00.000000000 Z
11
+ date: 2021-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstasher
@@ -242,6 +242,7 @@ files:
242
242
  - lib/govuk_app_config/govuk_healthcheck/sidekiq_redis.rb
243
243
  - lib/govuk_app_config/govuk_healthcheck/sidekiq_retry_size_check.rb
244
244
  - lib/govuk_app_config/govuk_healthcheck/threshold_check.rb
245
+ - lib/govuk_app_config/govuk_i18n.rb
245
246
  - lib/govuk_app_config/govuk_logging.rb
246
247
  - lib/govuk_app_config/govuk_statsd.rb
247
248
  - lib/govuk_app_config/govuk_unicorn.rb