From f04a3edcf48d569a511334966b7d0bd9110cce90 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 23 Oct 2025 11:10:09 +0200 Subject: [PATCH] Bug 39320: Use __n for languages with 3 plural forms (or more) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás Cohen Arazi --- .../ModuleDashboard/Widgets/ERMCounts.vue | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ModuleDashboard/Widgets/ERMCounts.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ModuleDashboard/Widgets/ERMCounts.vue index d69e08d97cf..c04ca367cf5 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ModuleDashboard/Widgets/ERMCounts.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ModuleDashboard/Widgets/ERMCounts.vue @@ -50,52 +50,56 @@ export default { { page: "AgreementsList", name: "agreements_count", - labelSingular: __("1 agreement"), - labelPlural: __("%s agreements"), + i18nLabel: count => + __n("%s agreement", "%s agreements", count).format(count), count: 0, }, { page: "LicensesList", name: "licenses_count", - labelSingular: __("1 license"), - labelPlural: __("%s licenses"), + i18nLabel: count => + __n("%s license", "%s licenses", count).format(count), count: 0, }, { name: "documents_count", - labelSingular: __("1 document"), - labelPlural: __("%s documents"), + i18nLabel: count => + __n("%s document", "%s documents", count).format(count), count: 0, }, { page: "EHoldingsLocalPackagesList", name: "eholdings_packages_count", - labelSingular: __("1 local package"), - labelPlural: __("%s local packages"), + i18nLabel: count => + __n("%s local package", "%s local packages", count).format( + count + ), count: 0, }, { page: "EHoldingsLocalTitlesList", name: "eholdings_titles_count", - labelSingular: __("1 local title"), - labelPlural: __("%s local titles"), + i18nLabel: count => + __n("%s local title", "%s local titles", count).format( + count + ), count: 0, }, { page: "UsageStatisticsDataProvidersList", name: "usage_data_providers_count", - labelSingular: __("1 usage data provider"), - labelPlural: __("%s usage data providers"), + i18nLabel: count => + __n( + "%s usage data provider", + "%s usage data providers", + count + ).format(count), count: 0, }, ]); const createCountText = definition => { - if (definition.count === 1) { - return definition.labelSingular; - } else { - return definition.labelPlural.format(definition.count); - } + return definition.i18nLabel(definition.count); }; async function getCounts() { -- 2.51.2