knowing where the user comes from

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • microgolf

    knowing where the user comes from

    Hey, i have a question.
    i'm about to run an multilangual (if that even is a word) site and i
    would
    like to adjust the language of the site depending on what region
    the user lives... is there a way to know?

    thanks in advance,
    microgolf
  • Joost Diepenmaat

    #2
    Re: knowing where the user comes from

    microgolf <microgolf@gmai l.comwrites:
    Hey, i have a question.
    i'm about to run an multilangual (if that even is a word) site and i
    would
    like to adjust the language of the site depending on what region
    the user lives... is there a way to know?
    There are ways to determine the user's location (with more or less
    precision) based on his IP address. On the other hand, it would be
    better to just use the user's language preference instead of his
    location. Conveniently, the language preference is send to the server
    at each request. On the third hand, most users never change their
    language preference (though local vendors may have set it for them).

    See, for example:
    Is it a good idea to use the HTTP Accept-Language header to determine the locale of the user?


    Which isn't really about language, but does touch on most of the
    relevant issues.

    --
    Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/

    Comment

    • Dr J R Stockton

      #3
      Re: knowing where the user comes from

      In comp.lang.javas cript message <d70ff805-94df-4a01-8aeb-5cd0d884acbe@m7
      3g2000hsh.googl egroups.com>, Fri, 6 Jun 2008 11:05:21, microgolf
      <microgolf@gmai l.composted:
      >i'm about to run an multilangual (if that even is a word) site and i
      >would
      >like to adjust the language of the site depending on what region
      >the user lives... is there a way to know?
      The place where the user is, the place where the user lives, and the
      place where the user comes from, and the places where the user's
      preferred language originated or is common, are not necessarily the
      same. And the computer is not necessarily set to the local language.

      Consider a hypothetical Ambassador to Poland who was born in Korea and
      is visiting the residence of the French Ambassador to Bulgaria, and who
      wants to read about a baseball game.

      To find what language the user wants, ask the user, as Wikipedia does.

      --
      (c) John Stockton, nr London, UK. ?@merlyn.demon. co.uk Turnpike v6.05 MIME.
      Web <URL:http://www.merlyn.demo n.co.uk/- FAQish topics, acronyms, & links.
      Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
      Do not Mail News to me. Before a reply, quote with ">" or "" (SonOfRFC1036)

      Comment

      • Tom Cole

        #4
        Re: knowing where the user comes from

        On Jun 6, 5:44 pm, Dr J R Stockton <j...@merlyn.de mon.co.ukwrote:
        In comp.lang.javas cript message <d70ff805-94df-4a01-8aeb-5cd0d884acbe@m7
        3g2000hsh.googl egroups.com>, Fri, 6 Jun 2008 11:05:21, microgolf
        <microg...@gmai l.composted:
        >
        i'm about to run an multilangual (if that even is a word) site and i
        would
        like to adjust the language of the site depending on what region
        the user lives... is there a way to know?
        >
        The place where the user is, the place where the user lives, and the
        place where the user comes from, and the places where the user's
        preferred language originated or is common, are not necessarily the
        same.  And the computer is not necessarily set to the local language.
        >
        Consider a hypothetical Ambassador to Poland who was born in Korea and
        is visiting the residence of the French Ambassador to Bulgaria, and who
        wants to read about a baseball game.
        >
        To find what language the user wants, ask the user, as Wikipedia does.
        >
        --
         (c) John Stockton, nr London, UK. ?...@merlyn.dem on.co.uk  Turnpike v6.05  MIME.
         Web  <URL:http://www.merlyn.demo n.co.uk/- FAQish topics, acronyms, & links.
         Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
         Do not Mail News to me. Before a reply, quote with ">" or "" (SonOfRFC1036)
        You may also try using something like:

        var lang = navigator['language'] || navigator['userLanguage'];

        And then use that to help you determine. For example mine returns en-
        us (or en-Us or en-US, depending on the browser).

        Of course the best way is to ask.

        Comment

        • VK

          #5
          Re: knowing where the user comes from

          On Jun 7, 3:07 am, Tom Cole <tco...@gmail.c omwrote:
          On Jun 6, 5:44 pm, Dr J R Stockton <j...@merlyn.de mon.co.ukwrote:
          >
          >
          >
          In comp.lang.javas cript message <d70ff805-94df-4a01-8aeb-5cd0d884acbe@m7
          3g2000hsh.googl egroups.com>, Fri, 6 Jun 2008 11:05:21, microgolf
          <microg...@gmai l.composted:
          >
          >i'm about to run an multilangual (if that even is a word) site and i
          >would
          >like to adjust the language of the site depending on what region
          >the user lives... is there a way to know?
          >
          The place where the user is, the place where the user lives, and the
          place where the user comes from, and the places where the user's
          preferred language originated or is common, are not necessarily the
          same. And the computer is not necessarily set to the local language.
          >
          Consider a hypothetical Ambassador to Poland who was born in Korea and
          is visiting the residence of the French Ambassador to Bulgaria, and who
          wants to read about a baseball game.
          >
          To find what language the user wants, ask the user, as Wikipedia does.
          >
          --
          (c) John Stockton, nr London, UK. ?...@merlyn.dem on.co.uk Turnpike v6.05 MIME.
          Web <URL:http://www.merlyn.demo n.co.uk/- FAQish topics, acronyms, & links.
          Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
          Do not Mail News to me. Before a reply, quote with ">" or "" (SonOfRFC1036)
          >
          You may also try using something like:
          >
          var lang = navigator['language'] || navigator['userLanguage'];
          >
          And then use that to help you determine. For example mine returns en-
          us (or en-Us or en-US, depending on the browser).
          >
          Of course the best way is to ask.
          The best way is to make an educated guess first - but to leave an
          option to change if the guess is wrong. As it was pointed out, there
          may be tricky occasional situations, say an American contractor in
          Germany using office PS with German Windows XP but en-US Firefox or
          IE. Or even German OS, German browser but preferred content language
          manually set to en-US. Unfortunately navigator.userL anguage (IE) and
          especially navigator.langu age (some others) are currently very lousy
          implemented in this aspect. They are still usable for an educated
          guess but an option for manual language switch should be provided.

          var lang = (navigator.user Language || navigator.langu age ||
          defaultLanguage );

          Comment

          • Jorge

            #6
            Re: knowing where the user comes from

            On Jun 6, 8:26 pm, Joost Diepenmaat <jo...@zeekat.n lwrote:
            There are ways to determine the user's location (with more or less
            precision) based on his IP address.
            But then, keep in mind that she might be coming trough a proxy.

            --Jorge.

            Comment

            • Dan Rumney

              #7
              Re: knowing where the user comes from

              microgolf wrote:
              Hey, i have a question.
              i'm about to run an multilangual (if that even is a word) site and i
              would
              like to adjust the language of the site depending on what region
              the user lives... is there a way to know?
              >
              Other posters have pointed out some of the vagaries of language detection.

              It's probably worth pointing out that there is an Accept-Language header
              that exists in an HTTP Request, so this is something that your webserver
              could handle.

              For example:


              Just an option for you to consider

              Comment

              • Thomas 'PointedEars' Lahn

                #8
                Re: knowing where the user comes from

                Tom Cole wrote:
                On Jun 6, 5:44 pm, Dr J R Stockton <j...@merlyn.de mon.co.ukwrote:
                >microgolf posted:
                >>i'm about to run an multilangual (if that even is a word) site and i
                >>would
                >>like to adjust the language of the site depending on what region
                >>the user lives... is there a way to know?
                >The place where the user is, the place where the user lives, and the
                >place where the user comes from, and the places where the user's
                >preferred language originated or is common, are not necessarily the
                >same. And the computer is not necessarily set to the local language.
                >>
                >Consider a hypothetical Ambassador to Poland who was born in Korea and
                >is visiting the residence of the French Ambassador to Bulgaria, and who
                >wants to read about a baseball game.
                >>
                >To find what language the user wants, ask the user, as Wikipedia does.
                [...]
                You may also try using something like:
                >
                var lang = navigator['language'] || navigator['userLanguage'];
                You can use dot notation instead, the property names are identifiers here.
                And then use that to help you determine.
                Don't.
                For example mine returns en-us (or en-Us or en-US, depending on the browser).
                My Firefox would yield "en-US" even though neither am I a speaker of English
                as first language, nor is the country I live in and I am are currently
                located in called The United States of America.
                Of course the best way is to ask.
                Most definitely. However, the Accept-Language header provides a much better
                hint than any `navigator' properties.


                PointedEars
                --
                Anyone who slaps a 'this page is best viewed with Browser X' label on
                a Web page appears to be yearning for the bad old days, before the Web,
                when you had very little chance of reading a document written on another
                computer, another word processor, or another network. -- Tim Berners-Lee

                Comment

                Working...