Web Analytics Made Easy -
StatCounter user's language - CodingForum

Announcement

Collapse
No announcement yet.

user's language

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new 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
    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...

    Comment


    • #3
      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

      Comment


      • #4
        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

        Comment


        • #5
          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]");

          Feyd
          New to the CF scene
          Last edited by Feyd; Jun 27, 2002, 08:36 PM.
          Moderator, Perl/CGI Forum
          shadowstorm.net - subvert society

          Comment


          • #6
            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

            Comment


            • #7
              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
              CodingForum Supreme Overlord
              All Hail Spookster

              Comment

              Working...
              X