Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Internationalization workaround  RSS feed

 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I was having trouble doing this in Struts so I come to think of this idea of templating and I want to hear your suggestions. My app comes in two versions, english and arabic. So now, the problem is how to convert everything to Arabic. The best idea I could think of so far is setting a session variable, then let my jsp decide which file(content) to include based on that...

Would this be a good idea? Or would my app suffer from an insignificant overhead? Thanks!
 
Stefan Evans
Bartender
Posts: 1834
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the i18n tutorial: http://java.sun.com/docs/books/tutorial/i18n/index.html

Also if you are using struts, the struts documentation has something to say on it: http://struts.apache.org/1.2.x/userGuide/building_view.html#i18n

The standard approach is to use Resource Bundles, and the users Locale.
Basically anywhere you have text on a JSP page, you instead put a reference to the resource bundle (normally via a custom tag)

JSTL provides custom tags: <fmt:setLocale>, <fmt:message>
Struts also provides i18n support with the <bean:message> tag.
They both use the same underlying structure though - resource bundles.

The other issue is that with arabic, everything is printed right to left, instead of left to right.
For that, you can use the "dir" attribute of the body tag to set that:
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/dir.asp
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/direction_1.asp

Cheers,
evnafets
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!