Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts internationalization problem

 
subhanair girish
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
subhanair girish
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
// 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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have forwarded to a different page but it is not getting..the switching is still not done
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which browser are you testing with? Have you tried this code with other browsers, e.g. Firefox, Chrome?
 
Hari Kammana
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rename your Resource bundle names to

ApplicationResources_de.properties
and
ApplicationResources_en.properties

I tested it, its working for me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic