So I am trying to implement a Struts 1 I18N application with some languages that are not supported by default (Swedish, Portuguese, Spanish etc.) But when I define Locale.Portuguese
in action controller for example, it would shows me PORTUGUESE cannot be resolved or is not a field
. Why? How can I extends it so that I can proceed with it? Can someone explains it how is it relatable?
public ActionForward french(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
HttpSession session = request.getSession();
session.setAttribute("org.apache.struts.action.LOCALE", Locale.FRENCH);
return mapping.findForward(SUCCESS);
}
If you don't find locale for your country and language in java.util.Locale
as static constants, you can create them yourself like this,
Locale portugese = new Locale("pt","PT");
Locale swedish = new Locale("sv","SE");
Locale spanish = new Locale("es","ES");
There are variations based upon the country where the same language is spoken but above should be good.