...

View Full Version : user's language



Crasy_J
06-27-2002, 08:18 PM
Hi, does anybody know how to get the user's language using PHP or JS or something.

I want to redirect the user depending on his language settings.
It's important to get the real settings and not only the browser's version.

Thanks for any ideas help.



bye

Joanna

SYP}{ER
06-27-2002, 09:35 PM
Why not just let them choose a language? I'm not sure there's a way to grab the language, but there prolly is if there's a browser setting for it.

whackaxe
06-27-2002, 09:44 PM
that can be done in javascript by extractiong a string from the browser name i think.

Crasy_J
06-28-2002, 01:30 AM
thanx for your replies!

I'm german, and when I'm visiting www.google.com it puts me to www.google.de -> the german version.
It's not stored in any kind of cookies or something.

I'm sure it's possible to get the user's language and not only the browser's language. I know there's a way with cgi, and now I'm looking for a PHP version.

I think JS only gives you the language of the browser and that's it, but hey... maybe I'm wrong !?!



any ideas?


Joanna

Feyd
06-28-2002, 01:34 AM
Try using strstr($HTTP_ACCEPT_LANGUAGE,"en-us")

as in


if(strstr($HTTP_ACCEPT_LANGUAGE,"en-us")) {
Header("Location: http://us.domain.ext/");
} else {
Header("Location: http://domain.ext/choose.php]");
}

Crasy_J
06-29-2002, 02:20 PM
Thank you for the answers but I'm not sure if this is the way.

I set my Browser's language to spanish then I deleted all cookies and went to www.google.com and voilá I was redirected to the german version.

It seems to me as if google doesn't use

$HTTP_ACCEPT_LANGUAGE

but something more powerful.

Isn't there a way to detect the OS language settings?



Joanna

Spookster
06-29-2002, 07:02 PM
They are probably just basing it off your IP address. They can know which countries blocks of IPs are from and then assume you want whatever corresponding language they have for your country.

When I was in Japan for a year I had a Japanese based ISP and I would always get redirected to japanese versions of various sites. It got really annoying.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum