Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: user's language

  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    183
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    paris, france
    Posts
    1,216
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    New Coder
    Join Date
    Jun 2002
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #5
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    403
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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]");

    Last edited by Feyd; 06-28-2002 at 12:36 AM.
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #6
    New Coder
    Join Date
    Jun 2002
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #7
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,278
    Thanks
    4
    Thanked 83 Times in 82 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •