wood burning stoves 2.0*
The moose likes Struts and the fly likes Problem changing languages struts 1.2.9 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem changing languages struts 1.2.9" Watch "Problem changing languages struts 1.2.9" New topic
Author

Problem changing languages struts 1.2.9

Manuel Jordan
Ranch Hand

Joined: Sep 29, 2006
Posts: 131
Hello guys i need your help

i am rookie about internationalization, well i read the chapter 11 of Struts in Action
and i am using Struts 1.2.9, and updating the old code example of the book to my version


well i create a simple ActionForm with only one variable

and an Action class doing only this


the jsp file only have these 2 fields



well by default i have my system in spanish (i live in southamerica)
and i use this 2 properties files ApplicationResources_es.properties and ApplicationResources_en.properties

and in my struts-config.xml

well its all related with my configuration


the problem is this, when i started up my tomcat 5.5.9 by first time (with this new configuration for internationalization)
, well the default language was in spanish of course and when i make or change the language to english in the simple form, works!
but if want back to spanish, well dont work any more, why? , inclusive if re start the server,
erase the private data (cookies etc etc) of the browser , or restart the pc, always still in english

the properties of idioms or language of the browser (firefox and opera) still have how first option spanish

how i can fix this???

remember i am rookie only with this topic of internationalization

thanks so much for advanced


kill your pride, share your knowledge with all
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
It looks like you've somehow changed the default language for Tomcat. I'm not sure how that happened, but check around some of the configuration files and see if you can reset it. If all else fails, ask this question in the Tomcat forum and see if anyone in that forum knows what might have happened.

One thing I did notice is that you've defined the message resources incorrectly in your Struts-config.xml file. The correct entry would be:

<message-resources parameter="ApplicationResources"/>

You should still have both an ApplicationResources_en.properties and an ApplicationResources_es.properties file in your WEB-INF/classes directory, but the bundle is only defined once with its base name.

Also, in your Action class, change your statement:

session.setAttribute(Locale.getDefault().toString(),locale);

to

super.setLocale(request, locale);


Merrill
Consultant, Sima Solutions
Manuel Jordan
Ranch Hand

Joined: Sep 29, 2006
Posts: 131
Hello Merrill Higginson

thanks for the reply , and works

yes , you was right about this, only declare

<message-resources parameter="ApplicationResources"/>
in the struts-config

and add the 2 other properties in the class folder

and your update code

the tomcat works normal again

thanks a lot for your time

i must now see, how apply the internationalization for the validation message errors

regards
Manuel Jordan
Ranch Hand

Joined: Sep 29, 2006
Posts: 131
Hello

how i can change with internationalization the value of the bottons?

i tried writing

<html:submit value="<bean:message key='label.x.y.z'> "/>

but show all how text,and i cant use <%%>

thanks for advanced
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
When you specify a body for the <html:submit> tag, the body is used as the value. Therefore, the following will work:

<html:submit property="save"><bean:message key="label.x.y.z"/></html:submit>
[ October 07, 2006: Message edited by: Merrill Higginson ]
Manuel Jordan
Ranch Hand

Joined: Sep 29, 2006
Posts: 131
Hello Merrill

thanks for the reply and time

works!!!

regards

DrPompeii
casinova guy
Greenhorn

Joined: Dec 04, 2008
Posts: 4
thanks a lot ..i know its old post but great fundas...i just stuck with internationalization and i found this post after 2 days of googling , and its work for me...thanks a loootttttttttttt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem changing languages struts 1.2.9