>4) write gettext in JavaScript. This could be done by converting the >existing django message files to dynamic javascript
Ok, to get a feel for my current favorite way to do it, I hacked up a very crude version that currently doesn't handle any pluralization that diverts from the one used in english (translating the given plural-form to javascript is the hard part). This is how a JavaScript catalog looks like: http://rfc1437.de/jsi18n/ To use it, check out the following page: http://media.rfc1437.de/testi18n.html Problems so far: - pluralization not yet fully handled - strings can only be translated as soon as the catalog is fully loaded - typical JS problem, if you use code from your library before it is fully available in the browser. - there is no string interpolation function in JS, but we need one for parameterized strings The patch is quite simple so far. Adding the catalog to a template would be done by a template tag, I think. And to make the catalog as small as possible, I would opt to change the make-messages.py and it's friends to handle translation domains. Currently we only use the domain "django", the javascript code would go to "djangojs" - that would result in two language files, but would give us the possibility to keep the size of the JS catalog small. Comments? Volunteers for writing the string interpolation function (preferably using python named parameter syntax) or the plural-form-to-javacript-compiler? :-) bye, Georg
