You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Raghuveer <ra...@infotechsw.com> on 2008/01/04 14:00:39 UTC
setting locale manually
How to set locale for my struts application.
My application will have 2 languages.
There will be 2 buttons in jsp page.
One button is polish and other is English.
on clicking of Polish button all the labels and button names and messages
are to be changed into polis language.
Any suggestions of implementing this
RE: setting locale manually
Posted by Raghuveer <ra...@infotechsw.com>.
Hello,
Since I have only to languages ,I have provided a button in screen and
passing url parameter "english" and "polish".
In Action file taking this language and forming locale object and setting to
ACTION method "setLocale"
Wprowadź - Enter
Above polish word is not coming exactly as label in JSP page when page is
rendered.
Could any one suggest any solution to resolve the i18N for messages.
----------
if(strLanguage!=null && strLanguage.equalsIgnoreCase("english")){
strLanguage="en";
strCountry="US";
}else if(strLanguage!=null && strLanguage.equalsIgnoreCase("polish")){
strLanguage="pl";
strCountry="PL";
}else{
strLanguage="pl";
strCountry="PL";
}
Locale locale=new Locale(strLanguage,strCountry);
setLocale(request,locale);
-----Original Message-----
From: Raghuveer [mailto:raghuveerv@infotechsw.com]
Sent: Friday, January 04, 2008 8:21 PM
To: 'Martin Gainty'
Cc: user@struts.apache.org
Subject: RE: setting locale manually
So you mean if I add request_locale=en_US in all forward this will work
OR if I add in first forward it is sufficient?
_____
From: Martin Gainty [mailto:mgainty@hotmail.com]
Sent: Friday, January 04, 2008 8:10 PM
To: raghuveerv@infotechsw.com
Subject: RE: setting locale manually
Czes Raghu
http://struts.apache.org/2.0.11/docs/i18n-interceptor.html
you can pass the locale on the request
and path accordingly
dziekuje!
Martin
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official
business of Sender. This transmission is of a confidential nature and Sender
does not endorse distribution to any party other than intended recipient.
Sender does not necessarily endorse content
> From: raghuveerv@infotechsw.com
> To: user@struts.apache.org
> Subject: setting locale manually
> Date: Fri, 4 Jan 2008 18:30:39 +0530
>
> How to set locale for my struts application.
>
> My application will have 2 languages.
>
> There will be 2 buttons in jsp page.
>
> One button is polish and other is English.
>
>
>
> on clicking of Polish button all the labels and button names and messages
> are to be changed into polis language.
>
>
>
> Any suggestions of implementing this
>
_____
Watch "Cause Effect," a show about real people making a real difference.
Learn <http://im.live.com/Messenger/IM/MTV/?source=text_watchcause> more
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: setting locale manually
Posted by Laurie Harper <la...@holoweb.net>.
From the documentation Martin linked to:
"For example, using the default parameter name, a request to
foo.action?request_locale=en_US, then the locale for US English is saved
in the user's session and will be used for all future requests."
So, specifying the locale parameter once is sufficient.
L.
Raghuveer wrote:
> So you mean if I add request_locale=en_US in all forward this will work
> OR if I add in first forward it is sufficient?
>
>
>
> _____
>
> From: Martin Gainty [mailto:mgainty@hotmail.com]
> Sent: Friday, January 04, 2008 8:10 PM
> To: raghuveerv@infotechsw.com
> Subject: RE: setting locale manually
>
>
>
> Czes Raghu
>
> http://struts.apache.org/2.0.11/docs/i18n-interceptor.html
> you can pass the locale on the request
> and path accordingly
>
> dziekuje!
>
> Martin
> ______________________________________________
> Disclaimer and confidentiality note
> Everything in this e-mail and any attachments relates to the official
> business of Sender. This transmission is of a confidential nature and Sender
> does not endorse distribution to any party other than intended recipient.
> Sender does not necessarily endorse content
>
>> From: raghuveerv@infotechsw.com
>> To: user@struts.apache.org
>> Subject: setting locale manually
>> Date: Fri, 4 Jan 2008 18:30:39 +0530
>>
>> How to set locale for my struts application.
>>
>> My application will have 2 languages.
>>
>> There will be 2 buttons in jsp page.
>>
>> One button is polish and other is English.
>>
>>
>>
>> on clicking of Polish button all the labels and button names and messages
>> are to be changed into polis language.
>>
>>
>>
>> Any suggestions of implementing this
>>
>
>
>
> _____
>
> Watch "Cause Effect," a show about real people making a real difference.
> Learn <http://im.live.com/Messenger/IM/MTV/?source=text_watchcause> more
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: setting locale manually
Posted by Raghuveer <ra...@infotechsw.com>.
So you mean if I add request_locale=en_US in all forward this will work
OR if I add in first forward it is sufficient?
_____
From: Martin Gainty [mailto:mgainty@hotmail.com]
Sent: Friday, January 04, 2008 8:10 PM
To: raghuveerv@infotechsw.com
Subject: RE: setting locale manually
Czes Raghu
http://struts.apache.org/2.0.11/docs/i18n-interceptor.html
you can pass the locale on the request
and path accordingly
dziekuje!
Martin
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official
business of Sender. This transmission is of a confidential nature and Sender
does not endorse distribution to any party other than intended recipient.
Sender does not necessarily endorse content
> From: raghuveerv@infotechsw.com
> To: user@struts.apache.org
> Subject: setting locale manually
> Date: Fri, 4 Jan 2008 18:30:39 +0530
>
> How to set locale for my struts application.
>
> My application will have 2 languages.
>
> There will be 2 buttons in jsp page.
>
> One button is polish and other is English.
>
>
>
> on clicking of Polish button all the labels and button names and messages
> are to be changed into polis language.
>
>
>
> Any suggestions of implementing this
>
_____
Watch "Cause Effect," a show about real people making a real difference.
Learn <http://im.live.com/Messenger/IM/MTV/?source=text_watchcause> more