This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes How to display in Hindi using Internationalisation through struts 1.3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to display in Hindi using Internationalisation through struts 1.3" Watch "How to display in Hindi using Internationalisation through struts 1.3" New topic
Author

How to display in Hindi using Internationalisation through struts 1.3

Raaja Gotluru
Ranch Hand

Joined: Mar 02, 2010
Posts: 108

Hi,

I am using struts 1.3 and try to build an web application to display in different locales. But I am unable to display the text in Hindi where as I am able to display in other languages like German, French, Italian. Can any one guide me how to develop that application to display in Hindi. If any one can post the code or guide me I will be greatful to them. I tried properties file by converting the Hindi text in to unicode(UTF-8) format also.

I am using the follwing action class

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception{

String language = (String) PropertyUtils.getSimpleProperty(form,"selectedItem");
System.out.println("language:"+language);
if (language.equals("english")){
HttpSession session = request.getSession();
session.setAttribute("org.apache.struts.action.LOCALE", Locale.ENGLISH);
System.out.println("###########english");
// return mapping.findForward("success");
}else if(language.equals("french")){
HttpSession session = request.getSession();
session.setAttribute("org.apache.struts.action.LOCALE", Locale.FRENCH);
System.out.println("###########french");
// return mapping.findForward("success");
}else if(language.equals("german")){
HttpSession session = request.getSession();
session.setAttribute("org.apache.struts.action.LOCALE", Locale.GERMAN);
System.out.println("###########german");

// return mapping.findForward("success");
}else if(language.equals("italian")){
HttpSession session = request.getSession();
session.setAttribute("org.apache.struts.action.LOCALE", Locale.ITALIAN);
System.out.println("###########italian");
// return mapping.findForward("success");
}
else if(language.equals("hindi")){
HttpSession session = request.getSession();
Locale locale = new Locale("hi","IN");
// session.setAttribute(ComponentConstants.LOCALE_KEY, locale);
// session.setAttribute("org.apache.struts.action.LOCALE",new Locale("hi"));

session.setAttribute("org.apache.struts.action.LOCALE", locale);
System.out.println("###########hindi");
// return mapping.findForward("success");
}
return mapping.findForward("success");

}



Thanking you.
--raaja
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Post your log file here when this action gets executed, also look for the correct .properties file name, the file must end with the proper ISO language code, like application_hi.properties.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to display in Hindi using Internationalisation through struts 1.3
 
Similar Threads
Internationalization Problen
Struts2 Internationalization
struts internationalization problem
Using struts2 only for internationalization
internalisation to hindi language not getting proper display...