i18n

"Christian Boulanger" <[email protected]>
Newsgroups gmane.comp.windows.devel.netwindows
Message-ID <000801c37026$fd3912b0$0200a8c0@Laptop>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.