Use ngettext where plurals are shown #1668
No reviewers
Labels
No labels
bug
contribution welcome
duplicate
enhancement
good first issue
help wanted
idea
Important
invalid
medium difficulty
question
upstream
Urgent
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
rimu/pyfedi!1668
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "nykula/pyfedi:ngettext"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The next pybabel extract + pybabel update should let translators into languages with complex plural forms improve the about page and the community side pane, as well a few flash alerts and other places.
This looks like a fundamental change in how we do translations, with no prior discussion.
Please bring me up to speed.
Gettext is a family of functions, of which the two main ones are gettext (often aliased to
_) and ngettext. The latter takes an English singular, an English plural, and a count of something, depending on which a plural is selected. Every PO file specifies the formula for selecting a plural depending on the count. During message extraction, source lines marked with ngettext rather than gettext automatically receive [multiple plural form](https://www.gnu.org/software/gettext/manual/html_node/Entries-with-Plural-Forms.html] inputs for each language according to its rules in Poedit, Weblate or another editor. When a plural isn't found, the corresponding English string is shown. This way, the programmer doesn't have to hardcode the pluralization rules for each language or get weirdly-looking combinations like "1 Users".It's documented in Flask-Babel hello world, so I didn't consider it a fundamental change. However, you're right, I should have brought this up in Zulip or an issue. I'd appreciate if someone with more Python experience then myself reviewed if I connected the plurals correctly.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.