Personal tools

Localization Notes For Laszlo Apps

From OpenLaszlo

There are many ways to implement a message catalog facility in LZX code.

One is to use the data facilities, and store your messages in a dataset.

Another is to use a simpler method such as the "${}" constraint mechanism to look up the data stored in a hash table.

One decision is do you want to compile this data into your app, or load the table of messages dynamically at runtime.

For compile time, you can still use data sets or Javascript objects.

For example you could make an <include> file

message.lzx:
<library>
<script>
<![CDATA[

var mymessages = {};

mymessages.hello = "Hello World!";
mymessages.goodbye = "Goodbye World!";
]]>
</script>
</library>

Then your main app could say


<include href="message.lzx"/>

<text text="${mymessage.hello}"/>

Or you could use a dataset

<data name="hello">
 <world>Hello World</world>
</data>

<text datapath="hello:/world/text()"/>