Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-27-2002, 07:18 PM   PM User | #1
Crasy_J
New Coder

 
Join Date: Jun 2002
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Crasy_J is an unknown quantity at this point
user's language

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
Crasy_J is offline   Reply With Quote
Old 06-27-2002, 08:35 PM   PM User | #2
SYP}{ER
Regular Coder

 
Join Date: Jun 2002
Location: Ontario, Canada
Posts: 183
Thanks: 0
Thanked 0 Times in 0 Posts
SYP}{ER is an unknown quantity at this point
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.
__________________
Offtone.com - In the works...
SYP}{ER is offline   Reply With Quote
Old 06-27-2002, 08:44 PM   PM User | #3
whackaxe
Senior Coder

 
Join Date: Jun 2002
Location: paris, france
Posts: 1,216
Thanks: 0
Thanked 0 Times in 0 Posts
whackaxe is an unknown quantity at this point
that can be done in javascript by extractiong a string from the browser name i think.
__________________
photoshop too expensive? use the GIMP! www.gimp.org
whackaxe is offline   Reply With Quote
Old 06-28-2002, 12:30 AM   PM User | #4
Crasy_J
New Coder

 
Join Date: Jun 2002
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Crasy_J is an unknown quantity at this point
But I do...

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
Crasy_J is offline   Reply With Quote
Old 06-28-2002, 12:34 AM   PM User | #5
Feyd
Regular Coder


 
Feyd's Avatar
 
Join Date: May 2002
Location: Los Angeles, CA Maxim: Subvert Society
Posts: 404
Thanks: 0
Thanked 0 Times in 0 Posts
Feyd is an unknown quantity at this point
Try using strstr($HTTP_ACCEPT_LANGUAGE,"en-us")

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

__________________
Moderator, Perl/CGI Forum
shadowstorm.net - subvert society

Last edited by Feyd; 06-28-2002 at 12:36 AM..
Feyd is offline   Reply With Quote
Old 06-29-2002, 01:20 PM   PM User | #6
Crasy_J
New Coder

 
Join Date: Jun 2002
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Crasy_J is an unknown quantity at this point
more than $HTTP_ACCEPT_LANGUAGE

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
Crasy_J is offline   Reply With Quote
Old 06-29-2002, 06:02 PM   PM User | #7
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,220
Thanks: 4
Thanked 80 Times in 79 Posts
Spookster will become famous soon enough
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.
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:54 AM.


Advertisement
Log in to turn off these ads.