I'm trying to set up Internationalization of JavaScript code in my Django application.
My Django app has a locale
subdirectory with a properly generated djangojs.po
file. The package definition is as follows:
# urls.py
js_info_dict = {
'packages': ('my_project',),
}
./manage.py makemessages
worked well as the .po
file contains all the to-be-translated strings but no JavaScript string ever gets translated on the website and the catalog is always empty.
I also had some problems with. This is how it works for me:
Add this to yr root urls.py:
In JS files use:
To compile django translation files: In a shell/terminal run from the project root (where 'apps', 'settings', etc lie):
i added my_project to INSTALLED APPS in settings.py and that seemed to do the trick