Ticket #12396: perms_name_translation.patch

File perms_name_translation.patch, 1.2 KB (added by Marcos Moyano, 15 years ago)
  • django/contrib/auth/management/__init__.py

     
    44
    55from django.db.models import get_models, signals
    66from django.contrib.auth import models as auth_app
     7from django.utils.translation import ugettext as _
     8from django.conf import settings
     9from django.utils import translation
    710
    811def _get_permission_codename(action, opts):
    912    return u'%s_%s' % (action, opts.object_name.lower())
    1013
    1114def _get_all_permissions(opts):
    1215    "Returns (codename, name) for all permissions in the given opts."
     16    translation.activate(settings.LANGUAGE_CODE)
    1317    perms = []
    1418    for action in ('add', 'change', 'delete'):
    15         perms.append((_get_permission_codename(action, opts), u'Can %s %s' % (action, opts.verbose_name_raw)))
     19        perms.append((_get_permission_codename(action, opts), _(u'Can %s %s') % (_(action), _(opts.verbose_name_raw))))
     20    translation.deactivate()
    1621    return perms + list(opts.permissions)
    1722
    1823def create_permissions(app, created_models, verbosity, **kwargs):
Back to Top