Re: Determining Locale in a Browser for Web 2.0 Applications

From: Peter Krefting (
Date: Mon Apr 20 2009 - 03:57:06 CDT

  • Next message: Adam Twardoch: "Re: more dingbats in plain text"


    > Will HTTP Accept-Language ever give you any more information than
    > Javascript's Navigator.language provides?

    It may, or may not. It might even be the same, depending on what browser you
    are using (I'm no JavaScript expert, so I cannot tell). Mine is currently
    set to "sv-SE,sv;q=0.9,nb;q=0.8,da;q=0.7,en;q=0.6" (I used to include "de"
    with a really low score as well, but some buggy servers then always sent me
    German instead of English, so I stopped doing that).

    Whether or not you will have a country code or just a language code depends
    on the browser, its user and the system it is on.

    > So I am just wondering if anyone has been thinking about exposing more
    > specific locale information inside of web browsers? For example, a
    > browser could just read the OS's locale information and expose that in a
    > relevant object accessible via Javascript.

    But then you run into the problem of trying to figure out which setting is
    authoritative. I am currently running an English OS, but it was initially
    installed with a Norwegian locale (I live and work in Norway) and my user
    is set up for Swedish. Depending on what data software looks at, programs
    prompt me in either English, Norwegian or Swedish, seemingly randomly. A bit

    For web applications, the Accept-Language is usually the one that is most
    correct, as people tend to set it up to get Google to work properly, except
    if it says just "en" or "en-US", in which case the user didn't care to
    change the default.

    Using Geolocation is usually bad, but it depends on what type of information
    you provide. I'm quite happy to get Swedish text (from Accept-Language) with
    prices in Norwegian currency (from geolocation) when I browse flights at my
    friendly local airline operator. But I'm equally unhappy with sites assuming
    that I want Norwegian *text* just because I'm in Norway (and with countries
    having more than one official language, that becomes even more fun).

    One thing you especially should *not* look at when deciding language is
    either the operating system or browser UI language. I know a lot of people
    using either or both in English, but wanting another language for regular
    text (or being forced to use English because the software isn't localised
    for their language).

    \\// Peter -

    This archive was generated by hypermail 2.1.5 : Mon Apr 20 2009 - 04:01:11 CDT