Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#11105 closed (duplicate)

Permission names should be translated on syncdb

Reported by: Henrique C. Alves Owned by: nobody
Component: Internationalization Version: 1.1-beta
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The basic permissions created during syncdb (add, change, delete) should be localized according to the LANGUAGE_CODE. Permission names are the only human-readable representation available to apps using contrib.auth, and are also used on contrib.admin, so it's kind of disappointing that all the admin is translated, but still unusable for managing permissions by non-english speakers because permissions aren't translated.

The relevant code is at django/contrib/auth/management/__init__.py:12

def _get_all_permissions(opts):
    "Returns (codename, name) for all permissions in the given opts."
    perms = []
    for action in ('add', 'change', 'delete'):
        perms.append((_get_permission_codename(action, opts), u'Can %s %s' % (action, opts.verbose_name_raw)))
    return perms + list(opts.permissions)

I tried a patch (see attachment), and created translations to my locale (pt_BR), but syncdb doesn't seem to consider translations.

Looking for an insight on this, fixing this should be trivial, and would help a lot those using contrib.auth (today I need to edit all my permission's names by hand to about 60 models, it sucks).

Attachments (2)

11beta1.diff (1.1 KB ) - added by Henrique C. Alves 15 years ago.
translate_permissions.diff (1.6 KB ) - added by Henrique C. Alves 15 years ago.
Fix for this particular case - just to keep track

Download all attachments as: .zip

Change History (4)

by Henrique C. Alves, 15 years ago

Attachment: 11beta1.diff added

comment:1 by Alex Gaynor, 15 years ago

Resolution: duplicate
Status: newclosed

Dupe of #1688.

in reply to:  1 comment:2 by Henrique C. Alves, 15 years ago

Replying to Alex:

Dupe of #1688.

Are you sure it's a dupe? I don't ask translating permission names on runtime in admin, but translating at 'syncdb' time.

by Henrique C. Alves, 15 years ago

Attachment: translate_permissions.diff added

Fix for this particular case - just to keep track

Note: See TracTickets for help on using tickets.
Back to Top