Use ngettext for progress percentages and update Russian plurals (#19707)
Summary of the issue:
The string "%d percent" is currently translated with a single form (e.g. "%d процент" in Russian). In languages like Russian that have multiple plural forms, this results in incorrect grammar (e.g. “1 процент” is correct, but “2 процент” should be “2 процента”, “5 процент” should be “5 процентов”). The code uses _() (gettext) which always picks the singular form from the translation catalogue, so plural forms cannot be used even if they are defined in the .po file.
Description of user facing changes:
Russian‑speaking users will now hear correctly pluralised percentage announcements:
1% → “1 процент”
2% → “2 процента”
5% → “5 процентов”
(and similarly for other numbers following Russian plural rules).
The same improvement can be applied to any other language that defines plural forms for this string; translators only need to supply the plural forms in their .po file.
Description of developer facing changes:
Two occurrences of _("%d percent") (in NVDAObjects/behaviors.py and winAPI/_powerTracking.py) have been replaced with ngettext("%d percent", "%d percent", n) % n. This allows the translation system to select the correct plural form based on the numeric value n. The gettext.ngettext function is imported where needed.
The Russian translation file (nvda.po) has been updated to include the three plural forms required for Russian: