Adding support for Intl.PluralRules for citation counts

This merge request is to resolve a localization issue raised by User:Wcalenieja on-wiki:

The tool currently displays stats at the top of the reference list (e.g., "total X citations, Y unknown links"). However, the localized strings do not account for linguistic pluralization rules.

For instance, in the Polish localization, a hardcoded singular/plural split (or complete lack of pluralization) results in ungrammatical outputs such as "5 książki" instead of "5 książek" (5 books) or "7 cytowania" instead of "7 cytowań" (7 citations). Polish (along with many other Slavic or complex language groups) requires a multi-form plural structure based on the cardinal number (https://www.unicode.org/cldr/charts/48/supplemental/language_plural_rules.html):

  • Form 1 (Ends in 1): 1 cytowanie
  • Form 2 (Ends in 2-4, except 12-14): 2, 3, 4 cytowania
  • Form 3 (Ends in 5-9, 0, or 11-14): 5, 7, 12 cytowań

Could we implement a proper pluralization mechanism for localization strings? MediaWiki handles this natively via {{PLURAL:}} in wikitext, or we could handle it via a native JavaScript plural rules mapping (like Intl.PluralRules) within the gadget initialization code to support more complex languages properly.

This merge requests implements support for using Intl.PluralRules , and adds updated localizations (one / few / many) for some (but not all) of our supported languages so far.

Screenshots

Example on Polish Wikipedia, with a "few" (X4) citations (34 cytowania), a few books (3 książki), one TV program (1 program telewizyjny), and many unknown links (6 nieznanych linków):

Citation dashboard 1

Another example on Polish Wikipedia, with many citations (88 cytowań), many books (9 książek), many TV programs (14 programów telewizyjnych), and a "few" (X4) unknown links (34 nieznane linki):

Citation dashboard 2

Edited by KevinPayravi

Merge request reports

Loading