Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

struts internationalization problem

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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....
 
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 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which browser are you testing with? Have you tried this code with other browsers, e.g. Firefox, Chrome?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
It's a tiny ad. At least, that's what she said.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic