RE: i18n
"Christian Boulanger" <[email protected]>
| Newsgroups | gmane.comp.windows.devel.netwindows |
|---|---|
| Message-ID | <003501c3732f$23b29870$0200a8c0@Laptop> |
I have to correct myself. The proposed method of course doesn't work ... If the undescored string has been translated once, it cannot be retranslated into the underscore string (duh!)! Instead, I what about markup? Something like <span i18n_lang="de" i18n_key="enter_password">Bitte Passwort eingeben</span> The server-side language could then translate underscore strings into this syntax (initial server-side translation), and the client can use the markup to do client-side translation. Maybe you already have thought of something more elegant... C. > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Christian Boulanger > Sent: Monday, September 01, 2003 10:19 AM > To: 'netWindows development discussion list' > Cc: 'Peter West'; 'Maik Arnold' > Subject: [NW-Devel] i18n > > > Hi everybody, > > I don't know how much you have been thinking about > internationalization of NW, but I have some suggestions and > would be happy to hear your thoughts on it. > > Like many other things, I think i18n should be done on the > client side, so that the language can be changed without a > reload. My suggestion would be to identify the phrases to be > translated by including an underscore,for example > "enter_password" in a popup window or "_copy" in a menu. > > A future NW command could load the translation file (see > below), parse it, and replace all InnerHTML elements of the > current DOM (or a part of it) which contain an underscore and > wich have a document.getElementById(element).firstchild.data > element in the translation file. > > __i18n__.translate(string filename, object DOMnode) > > to translate everything in the Domnode object according to the file. > > The translation file can be a static html page or be > generated from a database. I think it is better to have it be > a html table/form instead of xml so that it can be easily > viewed and updated. If generated, the file could include > input form elements for each empty cell which could then be > filled by the user: > > <html> > <form action="i18n.php" ....> > <table id="translations"> > <thead> > <th> > <td class="key">Key</th> > <td id="language" class="translation>English</th> > </th> > </thead> > <tbody> > <tr> > <td class="key">enter_password</td> > <td id="enter_password" > class="translation">Please enter > the password</td> > </tr> > <tr> > <!-- this is automatically generated if no > entry exists in the database--> > <td class="key">_copy</td> > <td id="_copy" class="translation> > <input type="text" name="_copy"/> > </td> > </tr> > </tbody> > </table> > <input type="submit" value="Save"/> > </form> > </html> > > To generate this file on the server, there could be a NW command like > > __i18n__.list(string language, object DOMnode) > > wich would send to the server the message (for example > ("de-German") and a list of the underscore expressions in the > domnode. The server can then generate a translation file > according to the specifications above. > > What do you think? > > Christian > > > _______________________________________________ > The netWindows developers list: [email protected] > http://netwindows.org/mailman/listinfo/devel_netwindows.org > > _______________________________________________ The netWindows developers list: [email protected] http://netwindows.org/mailman/listinfo/devel_netwindows.org