modilabs/formhub — pull request #561 by rgaudin (2012-08-06 11:54:37+00:00)
Title: JS i18n support

I've added support for i18n in JS files.
Django provides a mechanism to mimic gettext and to send mo extracted strings to JS.
You can see it in action at http://dev.formhub.org/jsi18n/ (set your browser locale to French first)

I've added gettext to mapview.js on odk_viewer. Check out the source code as an example of how to use it.

You'll notice that some strings have been move to the top of the file. This is because django' string extraction for JS is an ugly hack (since gettext does not support JS) and otherwise, those strings would never make it to the po file.
Check [this](http://nedbatchelder.com/blog/201104/a_javascript_lexer_in_python_and_the_saga_behind_it.html) if you want to know more. This better hack has been introduced in Django 1.4.

It's been deployed and tested on dev.