Ticket #12396: perms_name_translation.patch
File perms_name_translation.patch, 1.2 KB (added by , 15 years ago) |
---|
-
django/contrib/auth/management/__init__.py
4 4 5 5 from django.db.models import get_models, signals 6 6 from django.contrib.auth import models as auth_app 7 from django.utils.translation import ugettext as _ 8 from django.conf import settings 9 from django.utils import translation 7 10 8 11 def _get_permission_codename(action, opts): 9 12 return u'%s_%s' % (action, opts.object_name.lower()) 10 13 11 14 def _get_all_permissions(opts): 12 15 "Returns (codename, name) for all permissions in the given opts." 16 translation.activate(settings.LANGUAGE_CODE) 13 17 perms = [] 14 18 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() 16 21 return perms + list(opts.permissions) 17 22 18 23 def create_permissions(app, created_models, verbosity, **kwargs):