You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Antonio Sánchez <ju...@gmail.com> on 2013/06/25 12:27:24 UTC
Choosing locale from browser settings
Hello.
I need to return content localized to the browser locale from the very first
visit.
I guess I need:
1. Detect browser locale.
2. Apply that locale in response and subsequent session.
How can I do it?
Thanks!
Antonio
Re: Choosing locale from browser settings
Posted by Antonio Sánchez <ju...@gmail.com>.
It seems I18nInterceptor does it by default.
I've not found this feature in the documentation. I think it would be great to
document it.
Doing some research I've found that the way to do it, in case I18nInterceptor
is not enough, is inspecting the value of the "Accept-Language" request
header, in the Action or using a custom interceptor. I guess the last option
is better.
Thanks!
El Martes, 25 de junio de 2013 13:23:28 Chester Twomey escribió:
> Look into the i18n intereceptor:
>
> http://struts.apache.org/release/2.3.x/docs/i18n-interceptor.html
>
> An example:
> http://www.mkyong.com/struts2/struts-2-i18n-or-localization-example/
>
> On Tue, Jun 25, 2013 at 5:27 AM, Antonio Sánchez
>
> <ju...@gmail.com> wrote:
> > Hello.
> >
> > I need to return content localized to the browser locale from the very
> > first visit.
> >
> > I guess I need:
> >
> > 1. Detect browser locale.
> > 2. Apply that locale in response and subsequent session.
> >
> > How can I do it?
> >
> > Thanks!
> >
> > Antonio
>
> --
> ~Chester
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Choosing locale from browser settings
Posted by Chester Twomey <ch...@gmail.com>.
Look into the i18n intereceptor:
http://struts.apache.org/release/2.3.x/docs/i18n-interceptor.html
An example:
http://www.mkyong.com/struts2/struts-2-i18n-or-localization-example/
On Tue, Jun 25, 2013 at 5:27 AM, Antonio Sánchez
<ju...@gmail.com> wrote:
> Hello.
>
> I need to return content localized to the browser locale from the very first
> visit.
>
> I guess I need:
>
> 1. Detect browser locale.
> 2. Apply that locale in response and subsequent session.
>
> How can I do it?
>
> Thanks!
>
> Antonio
--
~Chester
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org