Opened 14 years ago
Closed 14 years ago
#14450 closed (duplicate)
Simple but powerfull patch to make application name localizable
Reported by: | Vsevolod Novikov | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.2 |
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 applied patch is used to make application names localizable for admin interface and also for other purposes.
This patch is applied to django v. 1.2.3 (django.VERSION = (1, 2, 3, 'final', 0))
It uses a new APP_NAMES variable from the user-provided settings.py which should be a dictionary having application label (model._meta.app_label) as a key, and application verbose name as a value. If the APP_NAMES is absent or doesn't contain a label of the application, the old schema (app_label.Title()) is used.
This way allows to localize application names exactly as other things in the project:
settings.py:
... from django.utils.translation import ugettext_lazy as _ ... INSTALLED_APPS = ( ... 'myapp.service', ... ) APP_NAMES = { 'service':_('Service') }
Now the "Service" string will appear in the django.po files for the whole project, so you can localize application names as you wish.
This patch is a minimalistic way to make a part of the job made by the patch published in the ticket #3591. Reasons why I've published the patch is - "simpler means more stable", and "One patch - one job".
Attachments (5)
Change History (7)
by , 14 years ago
Attachment: | sites.py.patch added |
---|
by , 14 years ago
Attachment: | templates.admin.patch added |
---|
Patch for admin templates to use a new app_name variable introduced in *.py.patch
comment:1 by , 14 years ago
Note that the web interface doesn't show all patched files in the templates.admin.patch for unknown reason - download the patch file instead to see all changes
by , 14 years ago
Attachment: | localization-for-application-name.patch added |
---|
All-in-one patch to use INSTEAD of the previously-submitted separate patches
comment:2 by , 14 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
This is very much related to #3591 and this year's Google Summer of Code project about the app loading that deals with the fact that app_labels are used improperly in a lot of places in Django. Translating the app names is one feature included in that branch which is slated to be worked in 1.4.
More places to patch on other pages