Re: i18n for JavaScript - Proposal

2005-12-04 Thread hugo
Hi, I just commited two patches that implement JavaScript translation based on my proposal to Django. I added translations to the date and time pickers in the admin and added the necessary tags and references to the admin app. If you want to create an empty translation file for JavaScript, you j

i18n for JavaScript - Proposal

2005-12-01 Thread hugo
Hi, after thinking a bit more and reading the comments on the thread, I think I have a useful proposal for this stuff: - we define a view function that sends out a JavaScript file based on .mo/.po files. This view uses the same routines that are used by django itself. To build the message files,

Re: i18n for JavaScript

2005-11-29 Thread hugo
>I much prefer this idea to the proposals involving XMLHttpRequest. We >can include the language definitions dictionary file with code like >this: Had a look at my posting with the sample implementation? It's exactly that what I do - delivering a dictionary with a few helper (that surprisingly lo

Re: i18n for JavaScript

2005-11-29 Thread Simon Willison
On 28 Nov 2005, at 19:48, Eugene Lazutkin wrote: Typical way to do it in js is to provide a language file separately from the code. The language file in most cases defines a single dictionary object. The code doesn't use text directly but uses a dictionary to fetch proper strings. Such d

Re: i18n for JavaScript

2005-11-28 Thread Petar Marić
On 11/28/05, hugo <[EMAIL PROTECTED]> wrote: > 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

Re: i18n for JavaScript

2005-11-28 Thread hugo
>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'

Re: i18n for JavaScript

2005-11-28 Thread hugo
>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 eng

Re: i18n for JavaScript

2005-11-28 Thread hugo
>I never saw b) done using algorithms. I would assume it is possible but >probably it should be written from scratch. But proper pluralization would be a requirement. Improper pluralization is a pain - and gettext already handles it quite nicely, so we should try to get a solution that gives us t

Re: i18n for JavaScript

2005-11-28 Thread Eugene Lazutkin
Inline. "hugo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > 2) offline generating javascript files for each language by running > them through the template engine (and using translation tags). This has > the benefit that javascript files can still be in the media server, but >

Re: i18n for JavaScript

2005-11-28 Thread Steven Armstrong
On 11/28/05 18:25, hugo wrote: My first instinct in this sort of case is to find out what others are doing, i.e. Dojo folks, RoR, TG, etc. That's what I did. Zilch. Nada. Zero. Nothing. Seems nobody ever cared about a proper solution to JavaScript and i18n. What they do are hacks, if they do s

Re: i18n for JavaScript

2005-11-28 Thread hugo
>My first instinct in this sort of case is to find out what others are doing, >i.e. Dojo folks, RoR, TG, etc. That's what I did. Zilch. Nada. Zero. Nothing. Seems nobody ever cared about a proper solution to JavaScript and i18n. What they do are hacks, if they do something at all. Some of those h

Re: i18n for JavaScript

2005-11-28 Thread hugo
>Another idea would be to translate the strings in the templates and >pass the translated strings to the JavaScript. This would make the >JavaScript not as "unobtrusive," but it's a compromise. But with dynamically generated content it will be rather weird - your code will be sprinkled with strin

Re: i18n for JavaScript

2005-11-28 Thread hugo
Hi, >We have the problem that some strings are in the JavaScript code for >the admin. That way those strings are not translateable for us with the >current situation. > >There are several ideas on how to solve this: I actually forgot one: 5) JavaScript uses XHR to fetch stringdata from Django.

Re: i18n for JavaScript

2005-11-28 Thread David Ascher
On 11/28/05, hugo <[EMAIL PROTECTED]> wrote: There are several ideas on how to solve this:All of which seem like they would apply beyond Django, no?My first instinct in this sort of case is to find out what others are doing, i.e. Dojo folks, RoR, TG, etc. --david

Re: i18n for JavaScript

2005-11-28 Thread Adrian Holovaty
On 11/28/05, hugo <[EMAIL PROTECTED]> wrote: > We have the problem that some strings are in the JavaScript code for > the admin. That way those strings are not translateable for us with the > current situation. Another idea would be to translate the strings in the templates and pass the translate

i18n for JavaScript

2005-11-28 Thread hugo
Hi, since this is a more developer oriented content, I post it to django-developers instead of django-i18n. This is ticket #945. We have the problem that some strings are in the JavaScript code for the admin. That way those strings are not translateable for us with the current situation. There