>Comments? Volunteers for writing the string interpolation function
>(preferably using python named parameter syntax) or the
>plural-form-to-javacript-compiler? :-)

Ok, looks like I mostly talk to myself ;-)

http://media.rfc1437.de/testi18n-sr.html

this gives you a test page that uses the 'sr' (serbian) catalog.
Because they have interesting pluraliziation rules. And because I got
pluralization working (actually it's dead simple, as the C-expression
that is in the .mo file is a valid JS expression, too).

So only a volunteer for the string interpolation is still needed ;-)

Some more thoughts on the JS-gettext:

- one problem is, this library must come from a dynamic page, because
it needs to pull together all language catalogs from the apps and the
project and django itself. It could be tuned by using caching, though.
Another option would be to just run the conversion code once on startup
and to store the javascript library in the MEDIA_ROOT - that way later
access will allways go to the static server, but then we have the
server writing to MEDIA_ROOT (which it will do anyway with FileField
and ImageField, so I am not that worried about that part). Only problem
is to avoid writing the lib with every new process - it would have to
be a place that really is only called once, and that's rather hard to
do with Apache. Maybe take the filedates of the .mo files into account
and only write the library if there is any new or updated .mo with
regard to the timestamp of the lib?

- pulling out strings will have to look into .js files, that's easy.
But what about JS included in templates? These are between <script>
tags and not that easy to find. Ok, I could do something like I did
with the templateize() function for django templates, only this time I
would just pull out the JS source instead converting translation tags.

bye, Georg

Reply via email to