File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes struts internationalization problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts internationalization problem" Watch "struts internationalization problem" New topic
Author

struts internationalization problem

subhanair girish
Greenhorn

Joined: Aug 12, 2008
Posts: 13
I have an application that must switch between English & german.

I have two options English and german in the home page.
I have used Dispatch action for both.This is my dispatch action class



In struts-config



i have set <html:html locale="true"> in all jsp pages.

Please help me in this..The problem is when I am loading the page, everything comes in german. the language switching is not happening.

Please help me in this....
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
When you define the message resources, it should not contain a language suffix. Even though you have properties files with different language suffixes, the definition should be without a suffix. Change your struts-config.xml file to:


Merrill
Consultant, Sima Solutions
subhanair girish
Greenhorn

Joined: Aug 12, 2008
Posts: 13
Thanks for your reply.
I have changed the struts-config.xml but it is not working yet.
I have put only one reference in struts-config,

Still it is displaying everything in english, noswitching takes place.
please help me in this....
subhanair girish
Greenhorn

Joined: Aug 12, 2008
Posts: 13
Hello,

can anybody help me in this switching between german - english in struts application..I desperately need a solutiion...Please help me in this....
subhanair girish
Greenhorn

Joined: Aug 12, 2008
Posts: 13
I have changed my action classes


My jsp page


Struts-config.xml


ApplicationResources_de_DE

ApplicationResources_en_US



please help me in this, the language switching is not happening. I am getting the messages read from the action class, and new locale is set in the session in action class.but when i click the link the page is not changing the locale.
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
// reset the Struts locale
session.setAttribute(Globals.LOCALE_KEY, locale);


I think the Struts framework, by default, gets the locale from the users browser for each request. It would not check session attributes for the current locale.

<forward name="home" path="/home.jsp"></forward>

Try to forward to a different page rather than the input page to the action.
[ October 06, 2008: Message edited by: James Clark ]
subhanair girish
Greenhorn

Joined: Aug 12, 2008
Posts: 13
I have forwarded to a different page but it is not getting..the switching is still not done
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Which browser are you testing with? Have you tried this code with other browsers, e.g. Firefox, Chrome?
Hari Kammana
Greenhorn

Joined: Nov 02, 2011
Posts: 1
Rename your Resource bundle names to

ApplicationResources_de.properties
and
ApplicationResources_en.properties

I tested it, its working for me.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts internationalization problem