View Full Version : Internationalization
mschipperheyn
04-23-2005, 04:54 PM
I would like struts like support for a message resource file that allows complete parametrization of the interface.
Marc
rfreedman
05-23-2005, 07:19 AM
I'll second that
nparise
06-22-2005, 06:56 PM
A i18n support a la STRUTS/JSF will be very appreciated
thank you
rasto1968
07-27-2005, 06:25 AM
Another vote for internationalization support from me. We are evaluating rcp as a replacement for webapps and Laszlo seems to be an almost perfect fit. However, we must be able to support internationalization so I think we will have to look elsewhere for the moment :( Something like the java resource bundles stuff would be perfect.
Rob
apolune
08-17-2005, 11:23 AM
Ditto!
jdfreedman
08-22-2005, 08:05 AM
I've been able to create a language neutral application by using language files stored in xml and by dynamically switching the file at run time. For example (only a snippet):
<locale>
<na>NA</na>
<yes>Yes</yes>
<no>No</no>
<true>True</true>
<false>False</false>
<close>Close</close>
<abort>Abort</abort>
<save>Save</save>
<application>
<title>TPG TeleManagement SEL 6</title>
<copyright>© Copyright 2005 TPG TeleManagement, Inc. All Rights Reserved.</copyright>
<version>6.0.0</version>
</application>
</locale>
And then have the following library of useful functions ...
<library>
<datasource name="languageHTTP">
<dataset name="langData" type="http" autorequest="true" src="languages/lang_english.xml"/>
</datasource>
<script>
<![CDATA[
function switchLocale(locale) {
canvas.languageHTTP.langData.setSrc("languages/lang_"+locale+".xml");
}
function localeString(textString) {
return("langData:/locale/"+textString+"/text()");
}
function getLocaleString(textString) {
return(canvas.datasets.langData.getPointer().xpath Query("locale/" + textString + "/text()"));
}
]]>
</script>
</library>
I then use the localeString function to set items' datapath:
<menuitem name="edit" datapath="${localeString('menu/evals/edit')}"/>
or
<text align="center" datapath="${localeString('pleaseWait/message')}" resize="true" fontsize="12" fontstyle="bold"/>
or in script, you can use the getLocalString() function call:
resp.addOption(getLocaleString('yes'), "1");
I then allow the user to switch locale with the following on their login screen (of course, their language preferences can be stored in their user profile and automatically assigned):
<view align="center">
<simplelayout axis="x" spacing="20"/>
<view resource="englishFlag" onclick="switchLocale('english');"/>
<view resource="germanFlag" onclick="switchLocale('german');"/>
<view resource="frenchFlag" onclick="switchLocale('french');"/>
<view resource="spanishFlag" onclick="switchLocale('spanish');"/>
</view>
Hope this helps!
Jeff
Originally posted by jdfreedman
...
<menuitem name="edit" datapath="${localeString('menu/evals/edit')}"/>
...
Hi,
i try to implement your code and the part with the menuitem works fine. But it doesn't for an menu.
<menu width="100" datapath="${localeString('settings')}">
How can i solve this problem? I need it urgent.
Thx
kimb
jdfreedman
11-11-2005, 12:35 PM
Kimb,
I've defined a "myMenu" class which extends menu for that very purpose:
<class name="myMenu" extends="menu">
<method event="oninit">
this._flisttarget.setDatapath(this.getAttribute('d atapath').xpath);
</method>
</class>
You could also place the oninit method directly in a regular menu tag. The trick is to get the button text to have the same datapath as the classroot.
This *should* work. Please let me know if it doesn't and I'll revisit my code.
Thanks,
Jeff
Jeff,
i put it directly in the menu and it works.
Absolutly perfect :)
Thanks
kimb
jdfreedman
11-14-2005, 05:12 AM
Excellent!! Glad to help.
Jeff
Jacek99
12-28-2005, 09:11 AM
+1 from me...I was actually looking for internationalization support in the docs and was surprised I couldn't find any. Hard to image creating an actual enterprise app in Laszlo without this...
Vaibhav
03-09-2006, 01:39 AM
Hi,
See this
http://www.laszlosystems.com/developers/community/forums/showthread.php?s=&postid=18067
with regards
Vaibhav
chhrahul
07-19-2006, 12:44 AM
Has anyone tried to use this on a tabslider?
Please let me know as i tried to fire th On init method for Tabslider and it does not work.
fchastanet
11-18-2006, 10:06 AM
Hello,
I am new to OpenLaszlo, I have tested some i18 systems described in this forum
but there is always a limitation, e.g. I couldn't have changed the title of my grid's columns using datapath. And I don't want to rewrite inherited class of all openlaszlo components.
So what do you think of my solution :
I Insert some calls to localized message like this in my Openlaszlo file (myfile.lsz):
#{mytable.mycolumn.title}
With an ant file, I process my openlazslo file and replace all occurences with localized message for each language, so it generates all those files:
en/myfile.lsz
fr/myfile.lsz
And I use the usual method to switch between locale
The advantage is that it reduces the processing of i18n during execution time.
Do you see some limitations ? or is there a better way to do this.
Thanks
François Chastanet
vernid
09-07-2007, 04:23 AM
Hi,
I implement the localization as described above in a menu, the menu is well displayed in the default language (here english) but when I call the switchLocale method nothing happened.
Do I need to do something to refresh/repaint the menu?
Dominique
antun
09-11-2007, 04:38 PM
Have you guys seen the LzProject application - it does handle I8n:
http://labs.openlaszlo.org/lzproject/
Source code and white paper are both available at the link above.
-Antun
vernid
09-12-2007, 03:30 AM
Antun,
Thanks for the link, but after having a breef look at the LSProject code it seems that it involves a REST webservices i18n method to return the correct label stored in a property file.
I had to adapt the solution described above, because I have the feeling that it was done for 3.3 and not 4.x (autorequest dataset attribute doesn't exist anymore) and I guess this autorequest attribute was to doing a doRequest each time that the src was assigned, then I added a doRequest when switching for one language to another.
Please find in attach the code, which could be usefull for others.
Regards
Dominique
dinee_432
10-17-2010, 09:11 PM
Can anybody help me out in using a .properties file. Please help me with a code sample.
Thanks,
Dinesh
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.