fatcodeguy
Programmer
Hi,
I have an application that implements the Struts framework on several pages (forms basically). I have to program the app in English and French, so I use PropertyResourceBundles and property files to get the tags to output, so I only need to have different property files.
However, when I try to imbed this in a Struts tag (like a button name), I get errors and have to do this
instead of
Should I be doing this another way? Is there a better way to do multilanguage support?
All help much appreciated. Thanks
I have an application that implements the Struts framework on several pages (forms basically). I have to program the app in English and French, so I use PropertyResourceBundles and property files to get the tags to output, so I only need to have different property files.
Code:
<%
Locale currentLocale=(Locale)session.getAttribute("locale");
PropertyResourceBundle labels=(PropertyResourceBundle)PropertyResourceBundle.getBundle("itp.resources.login",currentLocale);
//output with
out.println(labels.getString("label.login"));
>%
However, when I try to imbed this in a Struts tag (like a button name), I get errors and have to do this
Code:
<% if((Locale)session.getAttribute("locale")==Locale.ENGLISH) {%>
<td><html:submit value="Login" /></td>
<% }else if((Locale)session.getAttribute("locale")==Locale.FRENCH){ %>
<td><html:submit value="Accès" /></td>
<% } %>
instead of
Code:
<td><html:submit value="<% out.println(labels.getString("label.login.submitbutton")); %>" /></td>
Should I be doing this another way? Is there a better way to do multilanguage support?
All help much appreciated. Thanks