aspose file tools*
The moose likes Struts and the fly likes i18n Internationization HELP!  :) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: i18n Internationization HELP! :)