Opened 14 years ago
Last modified 6 years ago
#13764 closed
i18n in custum javascript [PATCH] — at Initial Version
Reported by: | Sebastian Noack | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.2 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
The admin javascript is using django.views.i18n for translation. I have added some cutom javascript to the admin, which needs i18n, too. It turned out that it is not that easy to add own translated texts to the admin, without adding another view function to each ModelAdmin that generates i18n javascript. You can subclass the AdminSite and override the i18n_javascript method, but that is not much convinient and you can not have translations per app or model. I have written a patch that moves the i18n_javascript method from the ModelSite to the ModelAdmin. In addition it adds the app of the ModelAdmin to the list of translation packages. So you can add own javascript translations, by just adding them to the app directory.