Opened 2 years ago

Closed 2 years ago

#20455 closed Bug (fixed)

Don't use plural forms without specific numbers

Reported by: Pike Owned by: frog32
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)

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 Changed 2 years ago by Pike

  • Cc Pike added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 Changed 2 years ago by frog32

  • Cc frog32@… added
  • Owner changed from nobody to frog32
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 2 years ago by frog32

  • 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 2 years ago by frog32 (previous) (diff)

comment:4 Changed 2 years ago by ramiro

  • Description modified (diff)

comment:5 Changed 2 years ago by claudep

  • Component changed from Uncategorized to Internationalization
  • Type changed from Uncategorized to Bug

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

  • Resolution set to fixed
  • Status changed from assigned to closed

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