Use ngettext for progress percentages and update Russian plurals#19707
Merged
seanbudd merged 6 commits intoFeb 27, 2026
Conversation
Replace a simple _() call with ngettext() when speaking progress percentages so the message is pluralization-aware. Update Russian locale file header (Plural-Forms, PO-Revision-Date, and X-Generator) to use the 3-form plural rule and refresh translations. Also include minor adjustments in winAPI/_powerTracking.py.
CyrilleB79
reviewed
Feb 26, 2026
The modified Russian locale PO file has been removed and restored the source file.
seanbudd
approved these changes
Feb 27, 2026
Member
|
thanks @Kostenkov-2021 |
5 tasks
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue number:
n/a
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.pofile.Description of user facing changes:
Russian‑speaking users will now hear correctly pluralised percentage announcements:
(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
.pofile.Description of developer facing changes:
Two occurrences of
_("%d percent")(inNVDAObjects/behaviors.pyandwinAPI/_powerTracking.py) have been replaced withngettext("%d percent", "%d percent", n) % n. This allows the translation system to select the correct plural form based on the numeric valuen. Thegettext.ngettextfunction is imported where needed.The Russian translation file (
nvda.po) has been updated to include the three plural forms required for Russian:Description of development approach:
ngettextbecause it is the standard gettext mechanism for pluralisation.msgstr.Testing strategy:
Manual testing performed:
.mofile.NVDA+Shift+Bwith various charge levels (1%, 2%, 5%, 11%, 21%, 22%, 25%, 100%).Automated tests:
Known issues with pull request:
None.
Code Review Checklist:
ngettextis already documented.