Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#12903 closed (fixed)

Missing plural forms in admin

Reported by: Stephane Raimbault Owned by: nobody
Component: Internationalization Version: dev
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Two strings are hard to translate, they don't have a plural form:

#: contrib/admin/templates/admin/actions.html:7
#, python-format
msgid ""
"<span class=\"_acnt\">0</span> of %(total_count)s %(module_name)s selected"
#: contrib/admin/templates/admin/actions.html:11
#, python-format
msgid "All %(total_count)s %(module_name)s selected"

Attachments (2)

12903-r12852.diff (9.0 KB ) - added by Ramiro Morales 15 years ago.
A new tentative patch for this
12903-r12937.diff (9.0 KB ) - added by Ramiro Morales 15 years ago.
New version of the patch, fixed a typo and changed method of passing a var from python to JS (hidden span -> JS var)

Download all attachments as: .zip

Change History (11)

comment:1 by Jannis Leidel, 15 years ago

Resolution: invalid
Status: newclosed

module_name already contains verbose_name or verbose_plural_name depending on the number of passed items. The span on line 7 is updated by Javascript so a plural form doesn't help. The note about having all items selected will only occur if having selected all items, plural.

comment:2 by Stephane Raimbault, 15 years ago

Resolution: invalid
Status: closedreopened

You're wrong when you say 'if having selected all items, plural.' The plural form depends on the number of items, see http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html for an explanation.

Even more, if all items are selected, I can be only 1 of 1, and the translation becomes incorrect in French, eg. '1 parmi 1 « groupe » sélectionnés' must be '1 parmi 1 « groupe » sélectionné' (final 's' removed and I use French quotes to work around another orthographical problem).

in reply to:  2 comment:3 by Jannis Leidel, 15 years ago

Triage Stage: UnreviewedAccepted

Replying to stephaner:

You're wrong when you say 'if having selected all items, plural.' The plural form depends on the number of items, see http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html for an explanation.

I'm aware how the plural form works, I just didn't see the special case of having just one item in the list.

Even more, if all items are selected, I can be only 1 of 1, and the translation becomes incorrect in French, eg. '1 parmi 1 « groupe » sélectionnés' must be '1 parmi 1 « groupe » sélectionné' (final 's' removed and I use French quotes to work around another orthographical problem).

Thanks for elaborating with the example, don't hesitate to work on a patch.

comment:4 by Jannis Leidel, 15 years ago

Resolution: fixed
Status: reopenedclosed

(In [12626]) Fixed #12903 - Added plural forms to a few strings in the admin actions template.

comment:5 by Stephane Raimbault, 15 years ago

Resolution: fixed
Status: closedreopened

My previous comment wasn't crystal clear, the fix is wrong because the plural form depends of the first argument, the number of selected items between span tag (not the second one, the number of results in the model).

The result in French is now:

1 parmi 5 sélectionnés
2 parmi 5 sélectionnés

but the right translation is:

1 parmi 5 sélectionné (plural form depends on first argument)
2 parmi 5 sélectionnés

The French translation will be even better with:

1 sélectionné parmi 5
2 sélectionnés parmi 5

We must give the full strings to the translators so they will be able to change the word ordering.
It isn't easy to provide the full string because the first argument is modified by Javascript code but may be, the full string could be moved Javascript side.

by Ramiro Morales, 15 years ago

Attachment: 12903-r12852.diff added

A new tentative patch for this

comment:6 by Ramiro Morales, 15 years ago

Has patch: set

by Ramiro Morales, 15 years ago

Attachment: 12903-r12937.diff added

New version of the patch, fixed a typo and changed method of passing a var from python to JS (hidden span -> JS var)

comment:7 by Ramiro Morales, 15 years ago

Resolution: fixed
Status: reopenedclosed

Fixed in [12968].

comment:8 by Stephane Raimbault, 15 years ago

Tested with success. Thank you!

comment:9 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

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