Title: How to test only for the language-code but not for the country?
i faced a similar problem and i override the processLocale method of ActionServlet as follows...
 
 protected void processLocale(HttpServletRequest request) {
 
  // Validate that we need to create a Locale
  if (!locale)
   return;             // Service not requested
  HttpSession session = request.getSession();
  if (session.getAttribute(Action.LOCALE_KEY) != null)
   return;             // Locale object is already present
 
  // Use the Locale returned by the servlet container (if any)
  Locale locale = request.getLocale();
  if (locale != null)
  {
   if (locale.getLanguage().equals("en"))
    locale = new Locale("en","US");
 
   if (locale.getLanguage().equals("nl"))
    locale = new Locale("nl","NL");
 
   if (!(locale.getLanguage().equals("en") || locale.getLanguage().equals("nl")))
    locale = new Locale("nl","NL");
    
   session.setAttribute(Action.LOCALE_KEY, locale);
  }
  else
  {
   locale = new Locale("nl","NL");
   session.setAttribute(Action.LOCALE_KEY, locale);
  }   
}
 
-----Original Message-----
From: Friedli Beat [UFA AG Her] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 12, 2001 10:22 AM
To: '[EMAIL PROTECTED]'
Subject: How to test only for the language-code but not for the country?

I want to test the Accept-Language and show a french message if the user speaks french.

But the following code doesn't take care of the Accept-Language fr-ch.

<logic:equal value="fr" header="Accept-Language">
  Welcome french
</logic:equal>

And this code doesn't take care of the Accept-Language fr-ch.

<logic:equal value="fr-ch" header="Accept-Language">
  Welcome french
</logic:equal>

Do I have to write my own tag? Has anybody allready an apropriate tag?

thanks

Beat Friedli



------------------------------------------------------------------------------
The information in this Internet email is confidential and may be
legally privileged. It is intended solely for the addressee. Access
to this Internet email by anyone else is unauthorised.

If you are not the intended recipient, any disclosure, copying, distribution
or any action taken or omitted to be taken in reliance on it, is prohibited
and may be unlawful. When addressed to our clients any opinions or advice
contained in this Internet email are subject to the terms and conditions
expressed in any applicable governing ING Barings' terms of business or
client engagement letter.

Visit us at www.ingbarings.com

------------------------------------------------------------------------------

Reply via email to