How to Change Locale ?

16 views
Skip to first unread message

Goldest

unread,
Aug 8, 2007, 6:51:19 AM8/8/07
to GWT-Ext Developer Forum
Hello,

I'am French and i would to know how can i change the locale file with
GWT-Ext ?
I see the file ext-lang-fr-min.js but how to use ??

Thanks

Désolé for my poor English ;-)

Sanjiv Jivan

unread,
Aug 8, 2007, 2:00:30 PM8/8/07
to gwt...@googlegroups.com
Just include that file after including the other Ext javascript files. If you need this to be dynamic, then check the 'locale' parameter (which is how GWT i18n works) and based on the locale parameter dynamically set the scripts src to the appropriate resource JS file.

Here's a snippet I found on the Ext forums. You can tailor it to work based on the 'locale' request parameter.


function checkLocal(){ 
var lang = navigator.language!=null ? navigator.language : navigator.browserLanguage;
var head = document.getElementsByTagName("head")[0];
var script = document.createElement ('script');
script.id = 'localScript';
script.type = 'text/javascript';
if (lang.indexOf("fr") != -1){
script.src = "local/local- fr.js";
}else{
script.src = "local/local-en.js";
}
head.appendChild(script);
}

Goldest

unread,
Aug 9, 2007, 5:20:23 AM8/9/07
to GWT-Ext Developer Forum
Thanks for your answer. it's work perfectly. Thanks again.


Reply all
Reply to author
Forward
0 new messages