Permalink
Browse files

Fixed #12903 - Made translating the admin action selection text easie…

…r. Thanks to Ramiro Morales for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12968 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent c3d1267 commit 31f7ff1518b863459820905d297ae538bd26f06c @jezdez jezdez committed Apr 13, 2010
@@ -12,17 +12,21 @@
.parent().parent().toggleClass(options.selectedClass, checked);
}
updateCounter = function() {
- var count = $(actionCheckboxes).filter(":checked").length;
- $("span._acnt").html(count);
+ var sel = $(actionCheckboxes).filter(":checked").length;
+ $(options.counterContainer).html(interpolate(
+ ngettext('%(sel)s of %(cnt)s selected', '%(sel)s of %(cnt)s selected', sel), {
+ sel: sel,
+ cnt: _actions_icnt
+ }, true));
$(options.allToggle).attr("checked", function() {
- if (count == actionCheckboxes.length) {
+ if (sel == actionCheckboxes.length) {
value = true;
showQuestion();
} else {
value = false;
clearAcross();
}
- return value
+ return value;
});
}
showQuestion = function() {

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -1035,14 +1035,12 @@ def changelist_view(self, request, extra_context=None):
else:
action_form = None
- 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': force_unicode(opts.verbose_name_plural),
- 'selection_note': selection_note % {'count': len(cl.result_list)},
+ 'selection_note': _('0 of %(cnt)s selected') % {'cnt': len(cl.result_list)},
'selection_note_all': selection_note_all % {'total_count': cl.result_count},
'title': cl.title,
'is_popup': cl.is_popup,
@@ -3,7 +3,8 @@
{% for field in action_form %}{% if field.label %}<label>{{ field.label }} {% endif %}{{ field }}{% if field.label %}</label>{% endif %}{% endfor %}
<button type="submit" class="button" title="{% trans "Run the selected action" %}" name="index" value="{{ action_index|default:0 }}">{% trans "Go" %}</button>
{% if actions_selection_counter %}
- <span class="action-counter"><span class="_acnt">0</span> {{ selection_note }}</span>
+ <script type="text/javascript">var _actions_icnt={{ cl.result_count|default_if_none:"0" }};</script>
+ <span class="action-counter">{{ selection_note }}</span>
{% if cl.result_count != cl.result_list|length %}
<span class="all">{{ selection_note_all }}</span>
<span class="question">
@@ -6,6 +6,8 @@
<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/changelists.css" />
{% if cl.formset %}
<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />
+ {% endif %}
+ {% if cl.formset or action_form %}
{% url admin:jsi18n as jsi18nurl %}
<script type="text/javascript" src="{{ jsi18nurl|default:'../../jsi18n/' }}"></script>
{% endif %}
@@ -1443,7 +1443,7 @@ def test_selection_counter(self):
Check if the selection counter is there.
"""
response = self.client.get('/test_admin/admin/admin_views/subscriber/')
- self.assertContains(response, '<span class="_acnt">0</span> of 2 selected')
+ self.assertContains(response, '0 of 2 selected')
class TestCustomChangeList(TestCase):

0 comments on commit 31f7ff1

Please sign in to comment.