Determining Locale in a Browser for Web 2.0 Applications

From: Ed Trager (
Date: Fri Apr 17 2009 - 22:14:15 CDT

  • Next message: James Kass: "Re: more dingbats in plain text"

    Hi, everyone,

    I'm working on some ideas for providing better support for localization in
    some "Web 2.0" applications.

    For example, consider a typical web form that asks for name, address, date
    of birth, etc. For better or for worse, we can envision presenting the user
    with a default form in English. At the top of the page, the form might have
    a drop-down selection list allowing users to choose alternate languages for
    the form - French, German, Arabic, Thai, Chinese, etc. ...

    If we can detect the user's locale, we can present the form immediately in
    the language specified by (any non-English) locale instead of the English
    fallback. Of course we will still have the drop-down selection list so
    users can still get any of the alternative language versions of the form if
    they want.

    Browsers such as Firefox (FF), Opera (OP), and Safari (SF) appear to


    ... while versions of Microsoft Internet Explorer (IE) provide:


    My first question: Is this all that is available?

    From a limited investigation on a Windows Vista "en-US" PC, I see that
    navigator.language is set to "en-US" in FF and SF, but Opera only returns
    "en". IE also returns "en-US" but in the IE-specific variables. When I
    installed the Thai version of FF, I got just "th", not "th-TH" or, say,

    So my 2nd question: Beyond the basic "language" code ("en", "th", "fr",
    etc.) I guess there is no reliable way within the browser environment to
    determine more specific locale information?

    For example, (3rd question...) am I correct in assuming that I *cannot*
    determine date format preferences? For example, if a browser like Opera is
    only going to tell me "en" and not "en-GB" or "en-US" or "en-AnywhereElse",
    then I guess there's no way to localize the date format to a preferred

    (As an aside, I just want to make it known to everyone that I personally
    *despise* localised date formats and think *everyone* all over the world
    should just use ISO YYYY-MM-DD format. That's my own "Ivory Tower" opinion,
    of course ... But here I am just asking the question ... )

    (4th Question ...) So I guess it is completely moot to think one could find
    out about preferred currency or numeric formats, or anything else that a
    "thick" client might be able to discover from operating system environment
    variables that I suppose are never really exposed within the browser

    - Ed

    This archive was generated by hypermail 2.1.5 : Fri Apr 17 2009 - 22:17:14 CDT