Opened 12 years ago

Closed 12 years ago

#20455 closed Bug (fixed)

Don't use plural forms without specific numbers

Reported by: Axel Hecht Owned by: Marc Egli
Component: Internationalization Version: dev
Severity: Normal Keywords:
Cc: Axel Hecht, 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 https://github.com/django/django/blob/master/django/contrib/admin/locale/en/LC_MESSAGES/django.po#L427

#: 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 by Axel Hecht, 12 years ago

Cc: Axel Hecht 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>

</pluralRules>

comment:2 by Marc Egli, 12 years ago

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

comment:3 by Marc Egli, 12 years ago

Has patch: set

I fixed this by using two separate strings.
https://github.com/frog32/django/commit/8b10363e08e4404a0023da46baee80f2efcb00b5

There is a post on the i18n mailing list about this:
https://groups.google.com/forum/?fromgroups#!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 12 years ago by Marc Egli (previous) (diff)

comment:4 by Ramiro Morales, 12 years ago

Description: modified (diff)

comment:5 by Claude Paroz, 12 years ago

Component: UncategorizedInternationalization
Type: UncategorizedBug

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

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