• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Forwarding to locale specific JSPs (I18N purpose)

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

I have to internationalize an existing Struts based application. We have chosen the approach of having locale specific JSPs in separate folders (as our GUI look and feel may change for each customer, otherwise we would have gone for resource bundle approach).

I have all JSPs translated to Japanese. So based on the user language selection, I have to forward to either say JP/someJSP.jsp or EN/someJSP.jsp.

I was wondering if there is any way where with little modification to struts-config.xml alone, this can be acheived.

Otherwise, I have to have something like this in in all my action classes ...

String lang = request.getParameter("Language");
mapping.findForward(lang+"_success");

and in struts-config.xml,

<forward name="EN_success" path="/webconsole/EN/someJSP.jsp"/>
<forward name="JP_success" path="/webconsole/JP/someJSP.jsp"/>

which looks very odd. I'm sure there is some other way...

Could anybody please help on this ASAP?

Thanks
Vidya.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As you know, Struts handling lf i18n is based on the idea of using a single JSP with multiple properties files for different languages. If you want to use a different model, it's not as easy to implement.

One possibility you might consider would be to extend some of the struts classes to handle i18n the way you want. For example, you could extend ActionForward to include a language attribute, and then extend ActionServlet and RequestProcessor to handle the language attribute the way you want.

The way you're doing it may seem a little kludgy, but it's really not a bad way to go.

Good luck.
 
Vidya Ram
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Merrill for the quick reply. I will try it out.

Vidya.
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

If You are using Tiles Framework for the presentation then u can have different tiles-def.xml for different Locales.
 
Whatever you say buddy! And I believe this tiny ad too:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic