Hi all,
In my application am using struts framework, to build internationalization.
The Appln will be started by taking the computer Locale like ex:en_US(english). And the Home Page wil allow the user to choose any lang. Like Chinese or German in the drop down menu. If the user selects the Chinese lang. then rest of the appl. should display in chinese lang. only.
For this mine code is.....
----------This code wil go in home.jsp ------
<html:form action="/Home" method="post">
<nobr><select name="tname" style="font-size:0.8em;" tabindex="1" class="button">
<option value="en" ><bean:message key="en"/></option>
<option value="de" ><bean:message key="de"/></option>
<option value="zh" ><bean:message key="zh"/></option>
</select>
</nobr>
<html:submit><bean:message key="selectlang"/></html:submit>
</html:form>
------This code wil go in homeForm.java ------
String tname=null;
public String getTname() {
return (this.tname);
}
public void setTname(String tname) {
this.tname = tname;
}
------This code wil go in homeAction.java ------
if(rEBHomeSearchForm.getTname()==null)
{
session.setAttribute("org.apache.struts.action.LOCALE", currentLocale.toString());
}
// For English Language selection
else if(rEBHomeSearchForm.getTname().equals("en"))
{
session.setAttribute("org.apache.struts.action.LOCALE", new Locale("en"));
}
// For Chinese language selection
{
session.setAttribute("org.apache.struts.action.LOCALE", new Locale("zh"));
}
// For German Language selection
else if(rEBHomeSearchForm.getTname().equals("de"))
{
session.setAttribute("org.apache.struts.action.LOCALE", new Locale("de"));
}
========
The problem is, am not able to mentain the session value of particular lang assigned by the user. If the user selects the chinese then the home wil be display but for next further pages its again displaying in english only.
Please tel me how to rectify my code.