I’ve been playing with localization on the client side. So I want to collect messages for djangojs from python and html files, but it didn’t work
Django version is 1.3,
Gettext utilitest are installed in the system
django-admin.py makemessages -d djangojs -l ru -e html,py
Does anyone know how to generate/use translations messages from django.po for JavaScript (djangojs)?
For example I put just ngettext("Hello world") messages for test reasons in some js file and finally it doesn’t get into djangojs.po file.
Sultan
I’m the author of this question: Django 1.2.3 – Internationalization – makemessages does not detect all strings.
Your problem has probably the same cause as mine. It is because the makemessages for javascript is a hack and sometimes doesn’t get the strings marked for translation. As the gettext tools do not support javascript, the code first goes through simple transforms and is then processed as Perl.
You can find an article about it here: A Javascript lexer in Python, and the saga behind it
And the bug report here: Ticket 7704. It is fixed in Django 1.4.
As my project was small, I edited the PO files directly but if yours is bigger you should use either django 1.4 RC or the patch linked in the bug report.