• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Problem changing languages struts 1.2.9

 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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);
 
Manuel Jordan
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Merrill

thanks for the reply and time

works!!!

regards

DrPompeii
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
If you send is by car it's a shipment, but if by ship it's cargo. This tiny ad told me:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic