From 6a7d153fbe4027c8b2476bab519b85b222440771 Mon Sep 17 00:00:00 2001 From: chao-xian Date: Wed, 16 Nov 2022 16:14:31 +0000 Subject: [PATCH] Add plurals dropped from rails-i18n in 7.0.6 The 7.0.6 release of rails-i18n dropped support for a number of plurals [1] and this causes our apps that make use of these languages to error and thus be unable to update to rails-i18n 7.0.6 This commit ports over these rules from rails-i18n to maintain the behaviour. This update follows what was added into govuk_app_config [2] [1]: https://github.com/svenfuchs/rails-i18n/pull/1017 [2]: https://github.com/alphagov/govuk_app_config/pull/266 --- config/locales/plurals.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/config/locales/plurals.rb b/config/locales/plurals.rb index 42e6655..80996c1 100644 --- a/config/locales/plurals.rb +++ b/config/locales/plurals.rb @@ -1,6 +1,19 @@ # frozen_string_literal: true { + # Welsh + cy: { i18n: { plural: { keys: %i[zero one two few many other], + rule: + lambda do |n| + case n + when 0 then :zero + when 1 then :one + when 2 then :two + when 3 then :few + when 6 then :many + else :other + end + end } } }, # Dari - this isn't an iso code. Probably should be 'prs' as per ISO 639-3. dr: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } }, # Latin America and Caribbean Spanish