You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by sumitjain23 <su...@gmail.com> on 2011/03/13 19:38:33 UTC

struts 2 internationalization problem

I am developing struts 2.2 application. When I pass a request_locale
parameter from a web page then it works fine i.e. the locale changes. But
when I try to change it programatically by setting the session parameter

session.setAttribute("WW_TRANS_I18N_LOCALE", "fr");

it does not work i.e. the locale does not change

Am I missing something. Please help me..


--
View this message in context: http://struts.1045723.n5.nabble.com/struts-2-internationalization-problem-tp3555588p3555588.html
Sent from the Struts - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: struts 2 internationalization problem

Posted by sumitjain23 <su...@gmail.com>.
If you look closely , I am doing the exact same thing i.e. setting the
session parameter 
"WW_TRANS_I18N_LOCALE" since I18nInterceptor.DEFAULT_SESSION_ATTRIBUTE is
equal to 
"WW_TRANS_I18N_LOCALE". But still it is not working

--
View this message in context: http://struts.1045723.n5.nabble.com/struts-2-internationalization-problem-tp3555588p3555923.html
Sent from the Struts - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: struts 2 internationalization problem

Posted by Jose Luis Martinez Avial <jl...@pb-santander.com>.
Sorry, it slipped. It would be something like this
//
String country = 'FR"
String language = 'fr'
Locale locale = null;
If(country!=null && langauge !=null)
	locale = new Locale(language ,country );
} 
else {
	locale = Locale.US;
}

sessionAttributes.put(I18nInterceptor.DEFAULT_SESSION_ATTRIBUTE,
locale); 
 

-----Original Message-----
From: Jose Luis Martinez Avial 
Sent: Monday, March 14, 2011 12:47 AM
To: 'Struts Users Mailing List'
Subject: RE: struts 2 internationalization problem

I usually do this

			Locale locale = new Locale(tokens[0],tokens[1]);
			} else {
	
if(!queries.isLocaleSupported(locale.toString())){
					log.debug("Locale "+locale+" no
soportado. Lo sustituimos por US");
					locale = Locale.US;
				}
			}
			log.info("User Locale is "+locale);
	
sessionAttributes.put(I18nInterceptor.DEFAULT_SESSION_ATTRIBUTE,
locale); 

-----Original Message-----
From: sumitjain23 [mailto:sumitjain91@gmail.com]
Sent: Sunday, March 13, 2011 2:39 PM
To: user@struts.apache.org
Subject: struts 2 internationalization problem

I am developing struts 2.2 application. When I pass a request_locale
parameter from a web page then it works fine i.e. the locale changes.
But when I try to change it programatically by setting the session
parameter

session.setAttribute("WW_TRANS_I18N_LOCALE", "fr");

it does not work i.e. the locale does not change

Am I missing something. Please help me..


--
View this message in context:
http://struts.1045723.n5.nabble.com/struts-2-internationalization-proble
m-tp3555588p3555588.html
Sent from the Struts - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Internet communications are not secure and therefore Banco 
Santander International does not accept legal responsibility for 
the contents of this message. Any views or opinions presented 
are solely those of the author and do not necessarily represent 
those of Banco Santander International unless otherwise 
specifically stated. 

Las comunicaciones v'ia Internet no son seguras y, por lo tanto,
Banco Santander International no asume responsabilidad legal 
ni de ning'un otro tipo por el contenido de este mensaje. 
Cualquier opini'on transmitida pertenece 'unicamente al autor y 
no necesariamente representa la opini'on de Banco Santander 
International, a no ser que est'e expresamente detallado.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: struts 2 internationalization problem

Posted by Jose Luis Martinez Avial <jl...@pb-santander.com>.
I usually do this

			Locale locale = new Locale(tokens[0],tokens[1]);
			} else {
	
if(!queries.isLocaleSupported(locale.toString())){
					log.debug("Locale "+locale+" no
soportado. Lo sustituimos por US");
					locale = Locale.US;
				}
			}
			log.info("User Locale is "+locale);
	
sessionAttributes.put(I18nInterceptor.DEFAULT_SESSION_ATTRIBUTE,
locale); 

-----Original Message-----
From: sumitjain23 [mailto:sumitjain91@gmail.com] 
Sent: Sunday, March 13, 2011 2:39 PM
To: user@struts.apache.org
Subject: struts 2 internationalization problem

I am developing struts 2.2 application. When I pass a request_locale
parameter from a web page then it works fine i.e. the locale changes.
But when I try to change it programatically by setting the session
parameter

session.setAttribute("WW_TRANS_I18N_LOCALE", "fr");

it does not work i.e. the locale does not change

Am I missing something. Please help me..


--
View this message in context:
http://struts.1045723.n5.nabble.com/struts-2-internationalization-proble
m-tp3555588p3555588.html
Sent from the Struts - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Internet communications are not secure and therefore Banco 
Santander International does not accept legal responsibility for 
the contents of this message. Any views or opinions presented 
are solely those of the author and do not necessarily represent 
those of Banco Santander International unless otherwise 
specifically stated. 

Las comunicaciones v'ia Internet no son seguras y, por lo tanto,
Banco Santander International no asume responsabilidad legal 
ni de ning'un otro tipo por el contenido de este mensaje. 
Cualquier opini'on transmitida pertenece 'unicamente al autor y 
no necesariamente representa la opini'on de Banco Santander 
International, a no ser que est'e expresamente detallado.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: struts 2 internationalization problem

Posted by Jose Luis Martinez Avial <jl...@pb-santander.com>.
It should work right away with that. Check after settint the locale if
is correct using :

Locale locale = ActionContext.getContext().getLocale();

That should return the same locale you selected.

-----Original Message-----
From: sumitjain23 [mailto:sumitjain91@gmail.com] 
Sent: Monday, March 14, 2011 2:20 AM
To: user@struts.apache.org
Subject: Re: struts 2 internationalization problem

Tried with a locale but still not working

--
View this message in context:
http://struts.1045723.n5.nabble.com/struts-2-internationalization-proble
m-tp3555588p3555928.html
Sent from the Struts - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Internet communications are not secure and therefore Banco 
Santander International does not accept legal responsibility for 
the contents of this message. Any views or opinions presented 
are solely those of the author and do not necessarily represent 
those of Banco Santander International unless otherwise 
specifically stated. 

Las comunicaciones v'ia Internet no son seguras y, por lo tanto,
Banco Santander International no asume responsabilidad legal 
ni de ning'un otro tipo por el contenido de este mensaje. 
Cualquier opini'on transmitida pertenece 'unicamente al autor y 
no necesariamente representa la opini'on de Banco Santander 
International, a no ser que est'e expresamente detallado.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: struts 2 internationalization problem

Posted by sumitjain23 <su...@gmail.com>.
Tried with a locale but still not working

--
View this message in context: http://struts.1045723.n5.nabble.com/struts-2-internationalization-problem-tp3555588p3555928.html
Sent from the Struts - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org