Opened 6 years ago

Closed 6 years ago

#20455 closed Bug (fixed)

Don't use plural forms without specific numbers

Reported by: Pike Owned by: Marc Egli
Component: Internationalization Version: master
Severity: Normal Keywords:
Cc: Pike, frog32@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Ramiro Morales)

There are a handful of languages which use the same grammatical form for 1 and, say, 11.

If you're using gettext plurals for a message that doesn't specify the number, you get

"Fix the following error." when there are actually 11 errors down the line.

Example would be

#: templates/admin/change_form.html:44 templates/admin/change_list.html:67
#: templates/admin/login.html:17
#: templates/admin/auth/user/change_password.html:27
#: templates/registration/password_change_form.html:20
msgid "Please correct the error below."
msgid_plural "Please correct the errors below."
msgstr[0] ""
msgstr[1] ""

Change History (6)

comment:1 Changed 6 years ago by Pike

Cc: Pike added

Example plural rule for reference, Lithuanian uses:

<pluralRules locales="lt">

<pluralRule count="one">n mod 10 is 1 and n mod 100 not in 11..19</pluralRule>
<pluralRule count="few">n mod 10 in 2..9 and n mod 100 not in 11..19</pluralRule>


comment:2 Changed 6 years ago by Marc Egli

Cc: frog32@… added
Owner: changed from nobody to Marc Egli
Status: newassigned
Triage Stage: UnreviewedAccepted

comment:3 Changed 6 years ago by Marc Egli

Has patch: set

I fixed this by using two separate strings.

There is a post on the i18n mailing list about this:!topic/Django-I18N/Ltt4ljM4WpM

I'll squash these two commits together and file a pull request if no one has problems in their translation.

Last edited 6 years ago by Marc Egli (previous) (diff)

comment:4 Changed 6 years ago by Ramiro Morales

Description: modified (diff)

comment:5 Changed 6 years ago by Claude Paroz

Component: UncategorizedInternationalization
Type: UncategorizedBug

comment:6 Changed 6 years ago by Claude Paroz <claude@…>

Resolution: fixed
Status: assignedclosed

In b3bccce1a09aae6dfb2eba7f77d3f373f03d8e0c:

Fixed #20455 -- Do not use ngettext for undefined plurals

Using two separate translation strings instead of gettext plural when
there is no reference to the number in the translated string. This
prevents some translations like Russian and Latvian to use the singular
form for 11 or 21.

Note: See TracTickets for help on using tickets.
Back to Top