Opened 9 years ago
Last modified 8 years ago
#25751 closed Cleanup/optimization
Translation of strings in a javascript file docs are incorrect — at Initial Version
Reported by: | George Tantiras | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.8 |
Severity: | Normal | Keywords: | javascript translation |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
To translate a string in a javascript file, the docs propose the following setup in the urls.py:
from django.views.i18n import javascript_catalog js_info_dict = { 'packages': ('your.app.package',), } urlpatterns = [ url(r'^jsi18n/$', javascript_catalog, js_info_dict), ]
This will not work unless the javascript url is added to urlpatterns under i18n_patterns:
from django.views.i18n import javascript_catalog from django.conf.urls.i18n import i18n_patterns js_info_dict = { 'packages': ('your.app.package',), } urlpatterns = [ ... ] urlpatterns += i18n_patterns( url(r'^jsi18n/$', javascript_catalog, js_info_dict), )
Note:
See TracTickets
for help on using tickets.