Getting Locale from User Agent
| From: | SLanger at spirit21 dot de | Date: | Thu, 17 Apr 2003 13:18:33 +0000 |
| Subject: | Getting Locale from User Agent | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-144281@lists.php.net to get a copy of this message | ||
Hello
Is there an easy way to get the locale as an iso lang dialect notation
from the client?
I know that I can parse the HTTP_ACCEPT_LANGUAGE in $_SERVER and try to
form one from it but I would like to have something like getLocale and it
will return 'en_EN' or 'de_DE' (etc...)
setlocale isn't quite what I'm looking for since it returns language
country as names e.g. German Germany (at least on my platform) and as far
as I understand it it can only be used to obtain the locale of the server.
So is there any build in function that can return a locale for the
useragent?
Thanks in advance
Stefan Langer