This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Struts and the fly likes i18n Internationization HELP!  :) Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "i18n Internationization HELP!  :)" Watch "i18n Internationization HELP!  :)" New topic
Author

i18n Internationization HELP! :)

Caliph Herald
Greenhorn

Joined: Apr 09, 2004
Posts: 16
Hi, I am atempting to give my application multi-language support.

I have 4 resource bundles set up in struts-config.xml:

<message-resources parameter="view.application"/>
<message-resources parameter="view.application_en"/>
<message-resources parameter="view.application_de"/>
<message-resources parameter="view.application_es"/>


i set the locale to true in jsp:
<html:html locale="true">
...
</html:html>

i thought that struts would see the locale set in the browsers request object and set the correct resouce bundle accordingly. It does not. It appears to set what ever is the LAST bundle registered in the struts-config.xml. Meaning if I placed the "view.application_de" bundle last , THAT is the bundle that would be used reguardless of the locale in the request object.

please advise

[ February 21, 2006: Message edited by: Caliph Herald ]
[ February 21, 2006: Message edited by: Caliph Herald ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You should only have one <message-resources> tag, not four.

<message-resources parameter="view.application"/>

You do still need four properties files. Struts will append the appropriate suffix for the locale when it's looking for a properties file to use.


Merrill
Consultant, Sima Solutions
Caliph Herald
Greenhorn

Joined: Apr 09, 2004
Posts: 16
Thank you Merrill, it worked like a charm! Is there anyway around having re-start the browser to see the change?
[ February 22, 2006: Message edited by: Caliph Herald ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
No, I don't believe there's a way around restarting the browser after changing the default locale.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: i18n Internationization HELP! :)
 
Similar Threads
Confirmation reg Properties file
struts internationalization problem
Struts making me nuts :)
Getting values from properties in validate-using multiple message-resources in struts
Dummy needs explanation