From 3bc459e178e8268d0869b204a47b22f4ff863b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=94=A6=E5=BF=83?= <41134017+Lhcfl@users.noreply.github.com> Date: Tue, 16 Jul 2024 15:17:18 +0800 Subject: [PATCH] FIX: Add plural definitions for Hungarian (#27933) Hungarian actually has a plural form (See: https://meta.discourse.org/t/issue-with-pluralized-count-translation-override/316019/8) In a past commit we introduced an external JS library to describe the plural form of the language. (https://github.com/discourse/discourse/commit/301713ef9631e52975781b60b8b4c4a0d75530cf) But this JS library actually has a slightly different pluralization definition than what we use in the backend (plurals.rb). ruby-i18n incorrectly assumes that Hungarian does not have plural forms. This resulted in singular text being used on the front end for Hungarian, but admins were unable to find and edit the singular text in customization. This commit adds a singular definition for Hungarian to the backend, compatible with the "make-plural/cardinals" library, thus fixing the above issue. --- config/locales/plurals.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/locales/plurals.rb b/config/locales/plurals.rb index e5208884076..ddec81f0432 100644 --- a/config/locales/plurals.rb +++ b/config/locales/plurals.rb @@ -42,7 +42,8 @@ he: { i18n: { plural: { keys: [:one, :other], rule: lambda { |n| n == 1 ? :one : :other } } } }, hi: { i18n: { plural: { keys: [:one, :other], rule: lambda { |n| [0, 1].include?(n) ? :one : :other } } } }, hr: { i18n: { plural: { keys: [:one, :few, :other], rule: lambda { |n| n % 10 == 1 && n % 100 != 11 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) ? :few : :other } } } }, - hu: { i18n: { plural: { keys: [:other], rule: lambda { |n| :other } } } }, + # The next line has a fix for ruby-i18n. Hungarian has plural forms. See https://meta.discourse.org/t/issue-with-pluralized-count-translation-override/316019/8 + hu: { i18n: { plural: { keys: [:one, :other], rule: lambda { |n| n == 1 ? :one : :other } } } }, hy: { i18n: { plural: { keys: [:one, :other], rule: lambda { |n| n == 1 ? :one : :other } } } }, id: { i18n: { plural: { keys: [:other], rule: lambda { |n| :other } } } }, is: { i18n: { plural: { keys: [:one, :other], rule: lambda { |n| n == 1 ? :one : :other } } } },