From 2dafe4ac3a8236621b4ee58bb2a17ebfeb06b900 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Mon, 1 Mar 2010 14:34:07 +0000 Subject: [PATCH] Fixed #12903 - Added plural forms to a few strings in the admin actions template. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12626 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/admin/options.py | 12 +++++++----- django/contrib/admin/templates/admin/actions.html | 11 +++-------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index 945fd3943e..d61074b19a 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -1037,13 +1037,15 @@ class ModelAdmin(BaseModelAdmin): else: action_form = None - if cl.result_count == 1: - module_name = force_unicode(opts.verbose_name) - else: - module_name = force_unicode(opts.verbose_name_plural) + selection_note = ungettext('of %(count)d selected', + 'of %(count)d selected', len(cl.result_list)) + selection_note_all = ungettext('%(total_count)s selected', + 'All %(total_count)s selected', cl.result_count) context = { - 'module_name': module_name, + 'module_name': force_unicode(opts.verbose_name_plural), + 'selection_note': selection_note % {'count': len(cl.result_list)}, + 'selection_note_all': selection_note_all % {'total_count': cl.result_count}, 'title': cl.title, 'is_popup': cl.is_popup, 'cl': cl, diff --git a/django/contrib/admin/templates/admin/actions.html b/django/contrib/admin/templates/admin/actions.html index f4e34215fa..77c2be09d9 100644 --- a/django/contrib/admin/templates/admin/actions.html +++ b/django/contrib/admin/templates/admin/actions.html @@ -3,18 +3,13 @@ {% for field in action_form %}{% if field.label %}{% endif %}{% endfor %} {% if actions_selection_counter %} - - {% blocktrans with cl.result_count as total_count %}0 of {{ total_count }} {{ module_name }} selected{% endblocktrans %} - + 0 {{ selection_note }} {% if cl.result_count != cl.result_list|length %} - - {% blocktrans with cl.result_count as total_count %}All {{ total_count }} {{ module_name }} selected{% endblocktrans %} - + {{ selection_note_all }} - {% blocktrans with cl.result_count as total_count %}Select all {{ total_count }} {{ module_name }}{% endblocktrans %} + {% blocktrans with cl.result_count as total_count %}Select all {{ total_count }} {{ module_name }}{% endblocktrans %} {% trans "Clear selection" %} {% endif %} {% endif %} -