GeeCON Prague 2014*
The moose likes Struts and the fly likes How to implement struts internationalization by taking the language locale from the Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to implement struts internationalization by taking the language locale from the" Watch "How to implement struts internationalization by taking the language locale from the" New topic
Author

How to implement struts internationalization by taking the language locale from the

ramana reddy B.V
Greenhorn

Joined: Apr 28, 2005
Posts: 2
Hi,

At present i'm developing a project in which i'm having the following requirement. In my project i need to disply the labels and messages in different languages based on the users preffered language.I am getting user's language from the database when he/she is logged in. Then i hav to display the messages in corresponding languages.

Please any one could suggest the solution.

regards
ramana
gunjan bohra
Ranch Hand

Joined: Mar 24, 2004
Posts: 40
read this
http://www.javaworld.com/javaworld/jw-05-2004/jw-0524-i18n.html
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
this article is useful, but doesn't cover enough re: struts internationalization. here's a better one...
http://www.allapplabs.com/struts/struts_internationalization.htm

your case needs a few additional steps...
1. you need to manually set the locale explicitly (using Filter or extend the ActionServlet or something else - if there's a single entry point in your app, then you can call this inside your Action) by


2. your html template should have <html:html locale="true">

3. if you use JSTL fmt:message instead of bean:message , you'll need to have this as well


-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
rajani arjun
Greenhorn

Joined: Nov 08, 2006
Posts: 8
hi,

localeFromDB what your talking what should be the format give one example

thanks
Rajani
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
What Alan is referring to here is a java.util.Locale object. As you can see from the javadoc, it has constructors that accept either just a language code, or a language code and a country code.


Merrill
Consultant, Sima Solutions
 
GeeCON Prague 2014
 
subject: How to implement struts internationalization by taking the language locale from the