From 5ab4f33b6a25233d96910887b8283982ad04f593 Mon Sep 17 00:00:00 2001 From: NotSqrt Date: Sat, 6 Jul 2013 12:13:36 +0200 Subject: [PATCH] check i18n completeness --- djadmin2/actions.py | 12 ++++++------ .../actions/delete_selected_confirmation.html | 6 +++--- djadmin2/templates/admin2/bootstrap/app_index.html | 2 +- djadmin2/templates/admin2/bootstrap/auth/login.html | 2 +- djadmin2/templates/admin2/bootstrap/auth/logout.html | 2 +- .../admin2/bootstrap/auth/password_change_done.html | 2 +- .../admin2/bootstrap/auth/password_change_form.html | 4 ++-- djadmin2/templates/admin2/bootstrap/base.html | 8 +++----- .../admin2/bootstrap/model_confirm_delete.html | 2 +- .../templates/admin2/bootstrap/model_detail.html | 2 +- djadmin2/templates/admin2/bootstrap/model_list.html | 10 ++++++---- .../admin2/bootstrap/model_update_form.html | 2 +- djadmin2/views.py | 5 +++-- 13 files changed, 30 insertions(+), 29 deletions(-) diff --git a/djadmin2/actions.py b/djadmin2/actions.py index 446e9d7..628ccf6 100644 --- a/djadmin2/actions.py +++ b/djadmin2/actions.py @@ -22,9 +22,9 @@ class BaseListAction(AdminModel2Mixin, TemplateView): permission_classes = (permissions.IsStaffPermission,) - empty_message = 'Items must be selected in order to perform actions ' + \ - 'on them. No items have been changed.' - success_message = 'Successfully deleted %d %s' + empty_message = _('Items must be selected in order to perform actions ' + 'on them. No items have been changed.') + success_message = _('Successfully deleted %(count)d %(items)s') queryset = None @@ -98,9 +98,9 @@ class BaseListAction(AdminModel2Mixin, TemplateView): if request.POST.get('confirmed'): if self.process_queryset() is None: - message = _(self.success_message % ( - self.item_count, self.objects_name) - ) + message = _(self.success_message % { + 'count': self.item_count, 'items': self.objects_name + }) messages.add_message(request, messages.INFO, message) return None diff --git a/djadmin2/templates/admin2/bootstrap/actions/delete_selected_confirmation.html b/djadmin2/templates/admin2/bootstrap/actions/delete_selected_confirmation.html index e4d0911..fa5d87f 100644 --- a/djadmin2/templates/admin2/bootstrap/actions/delete_selected_confirmation.html +++ b/djadmin2/templates/admin2/bootstrap/actions/delete_selected_confirmation.html @@ -1,13 +1,13 @@ {% extends "admin2/bootstrap/base.html" %} {% load admin2_tags i18n %} -{% block title %}Are you sure?{% endblock title %} +{% block title %}{% trans "Are you sure?" %}{% endblock title %} -{% block page_title %}Are you sure?{% endblock page_title %} +{% block page_title %}{% trans "Are you sure?" %}{% endblock page_title %} {% block breadcrumbs %}
  • - Home + {% trans "Home" %} /
  • diff --git a/djadmin2/templates/admin2/bootstrap/app_index.html b/djadmin2/templates/admin2/bootstrap/app_index.html index fc2be4d..5ed20d4 100644 --- a/djadmin2/templates/admin2/bootstrap/app_index.html +++ b/djadmin2/templates/admin2/bootstrap/app_index.html @@ -3,7 +3,7 @@ {% block breadcrumbs %}
  • - Home + {% trans "Home" %} /
  • {{ app_label|title }}
  • diff --git a/djadmin2/templates/admin2/bootstrap/auth/login.html b/djadmin2/templates/admin2/bootstrap/auth/login.html index 128a9c1..c055c15 100644 --- a/djadmin2/templates/admin2/bootstrap/auth/login.html +++ b/djadmin2/templates/admin2/bootstrap/auth/login.html @@ -12,7 +12,7 @@ {% block breacrumbs %}{% endblock breacrumbs %} {% block class_page_title %}span12 login-title{% endblock class_page_title %} -{% block page_title %}{% trans "Site administration" %} - Login{% endblock page_title %} +{% block page_title %}{% trans "Site administration" %} - {% trans "Login" %}{% endblock page_title %} {% block content %}
    diff --git a/djadmin2/templates/admin2/bootstrap/auth/logout.html b/djadmin2/templates/admin2/bootstrap/auth/logout.html index 25f383f..7da8675 100644 --- a/djadmin2/templates/admin2/bootstrap/auth/logout.html +++ b/djadmin2/templates/admin2/bootstrap/auth/logout.html @@ -5,7 +5,7 @@ {% block breadcrumbs %}
  • - Home + {% trans "Home" %} /
  • {% trans "Logout" %}
  • diff --git a/djadmin2/templates/admin2/bootstrap/auth/password_change_done.html b/djadmin2/templates/admin2/bootstrap/auth/password_change_done.html index 66a45ee..6f1b352 100644 --- a/djadmin2/templates/admin2/bootstrap/auth/password_change_done.html +++ b/djadmin2/templates/admin2/bootstrap/auth/password_change_done.html @@ -8,7 +8,7 @@ {% block breadcrumbs %}
  • - Home + {% trans "Home" %} /
  • {% trans "Password change successful" %}
  • diff --git a/djadmin2/templates/admin2/bootstrap/auth/password_change_form.html b/djadmin2/templates/admin2/bootstrap/auth/password_change_form.html index f49abe7..18d6408 100644 --- a/djadmin2/templates/admin2/bootstrap/auth/password_change_form.html +++ b/djadmin2/templates/admin2/bootstrap/auth/password_change_form.html @@ -7,7 +7,7 @@ {% block breadcrumbs %}
  • - Home + {% trans "Home" %} /
  • {% trans "Password change" %} /
  • @@ -17,7 +17,7 @@ {% block content %}
    -

    Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly.

    +

    {% trans "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." %}

    {% if form.errors %}

    diff --git a/djadmin2/templates/admin2/bootstrap/base.html b/djadmin2/templates/admin2/bootstrap/base.html index dd2448f..f65acf4 100644 --- a/djadmin2/templates/admin2/bootstrap/base.html +++ b/djadmin2/templates/admin2/bootstrap/base.html @@ -3,7 +3,7 @@ - {% block title %}Site administration{% endblock title %} | django-admin2 + {% block title %}{% trans "Site administration" %}{% endblock title %} | django-admin2 {% block css %} @@ -31,9 +31,7 @@ {% if user.get_full_name %} {{ user.get_full_name }} {% else %} - {% blocktrans with user=user.username %} - Logged in as {{ user }} - {% endblocktrans %} + {% blocktrans with user=user.username %}Logged in as {{ user }}{% endblocktrans %} {% endif %} @@ -54,7 +52,7 @@ {% block breacrumbs %}

    {% endblock breacrumbs %} diff --git a/djadmin2/templates/admin2/bootstrap/model_confirm_delete.html b/djadmin2/templates/admin2/bootstrap/model_confirm_delete.html index 819fd76..8f35b96 100644 --- a/djadmin2/templates/admin2/bootstrap/model_confirm_delete.html +++ b/djadmin2/templates/admin2/bootstrap/model_confirm_delete.html @@ -7,7 +7,7 @@ {% block breadcrumbs %}
  • - Home + {% trans "Home" %} /
  • diff --git a/djadmin2/templates/admin2/bootstrap/model_detail.html b/djadmin2/templates/admin2/bootstrap/model_detail.html index b115fcf..118d01c 100644 --- a/djadmin2/templates/admin2/bootstrap/model_detail.html +++ b/djadmin2/templates/admin2/bootstrap/model_detail.html @@ -8,7 +8,7 @@ {% block breadcrumbs %}
  • - Home + {% trans "Home" %} /
  • diff --git a/djadmin2/templates/admin2/bootstrap/model_list.html b/djadmin2/templates/admin2/bootstrap/model_list.html index e021a68..d5c521a 100644 --- a/djadmin2/templates/admin2/bootstrap/model_list.html +++ b/djadmin2/templates/admin2/bootstrap/model_list.html @@ -11,7 +11,7 @@ {% block breadcrumbs %}
  • - Home + {% trans "Home" %} /
  • @@ -28,8 +28,8 @@
    @@ -55,7 +55,9 @@
  • - 0 of {{ object_list|length }} selected + + {% blocktrans with selected='0' total=object_list|length %}{{selected}} of {{total}} selected{% endblocktrans %} +
    {% if permissions.has_add_permission %} {% blocktrans with model_verbose_name=model|model_verbose_name %}Add {{ model_verbose_name }}{% endblocktrans %} diff --git a/djadmin2/templates/admin2/bootstrap/model_update_form.html b/djadmin2/templates/admin2/bootstrap/model_update_form.html index f9cd750..d5b5825 100644 --- a/djadmin2/templates/admin2/bootstrap/model_update_form.html +++ b/djadmin2/templates/admin2/bootstrap/model_update_form.html @@ -8,7 +8,7 @@ {% block breadcrumbs %}
  • - Home + {% trans "Home" %} /
  • diff --git a/djadmin2/views.py b/djadmin2/views.py index fb08700..70551bf 100644 --- a/djadmin2/views.py +++ b/djadmin2/views.py @@ -4,6 +4,7 @@ from django.contrib.auth.views import (logout as auth_logout, login as auth_login) from django.contrib.auth import get_user_model from django.core.urlresolvers import reverse, reverse_lazy +from django.utils.translation import ugettext_lazy from django.db import models from django.http import HttpResponseRedirect from django.utils.encoding import force_text @@ -161,7 +162,7 @@ class ModelEditFormView(AdminModel2Mixin, Admin2ModelFormMixin, extra_views.Upda def get_context_data(self, **kwargs): context = super(ModelEditFormView, self).get_context_data(**kwargs) context['model'] = self.get_model() - context['action'] = "Change" + context['action'] = ugettext_lazy("Change") return context @@ -175,7 +176,7 @@ class ModelAddFormView(AdminModel2Mixin, Admin2ModelFormMixin, extra_views.Creat def get_context_data(self, **kwargs): context = super(ModelAddFormView, self).get_context_data(**kwargs) context['model'] = self.get_model() - context['action'] = "Add" + context['action'] = ugettext_lazy("Add") return context