Title: RE: Getting the Locale from the Browser
Enumeration e = request.getHeaderNames()
while (e.hasMoreElements())
{
String KeyValue = (String) e.nextElement();
if (KeyValue.equals(Accept-Language)
// e.getHeader(KeyValue) is the locale, ie, en-us
}
-Original Message-
From
://www.orionserver.com
- Original Message -
From: Ian Holsman [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, October 27, 1999 8:19 PM
Subject: Getting the Locale from the Browser
hi.
I would like to get the locale of the user's browser in order to do
language specific stuff
The information is hidden in the request headers.
An example is in the JVMInfo.jsp I sent out about two hours ago.
Robert
hi.
I would like to get the locale of the user's browser in order to do
language specific stuff.
how do I do this ???
Thanks
Ian.
Holsman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 27, 1999 1:19 PM
To: [EMAIL PROTECTED]
Subject: Getting the Locale from the Browser
hi.
I would like to get the locale of the user's browser in ord
this header ("Accept-Language") may not be included. It depends on
you browser settings (see preferences).
Enumeration e = request.getHeaderNames()
while (e.hasMoreElements())
{
String KeyValue = (String) e.nextElement();
if (KeyValue.equals("Accept-Language")
//
this may or may not help you directly dependent upon
the specific servlet implementation your using. for
servlet 2.2 compliant implementations there is a
javax.ServletRequest.getLocale() method which will
return a Local object based upon the Accept-Language
request header.
hope this helps,
-