W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2016

Re: [whatwg] Should navigator.language and and/or HTTP Accept-Language include locale?

From: Nils Dagsson Moskopp <nils@dieweltistgarnichtso.net>
Date: Tue, 24 May 2016 01:55:53 +0200
To: Geoffrey Garen <ggaren@apple.com>, WHAT Working Group <whatwg@whatwg.org>
Message-ID: <8760u4mira.fsf@dieweltistgarnichtso.net>
Cc: Phil Pizlo <fpizlo@apple.com>, Alexey Proskuryakov <ap@apple.com>
Geoffrey Garen <ggaren@apple.com> writes:

> Hi folks.
>
> Should navigator.language and/or HTTP Accept-Language include my
> locale in addition to my language — even if the combination is exotic?
>
> For example, if I speak English but I like Polish number formatting,
> should navigator.language report “en-pl”?
>
> This question came up in WebKit because ECMA-402’s DefaultLocale()
> incorporates both language and locale and, to avoid confusion, we
> wanted navigator.language, HTTP Accept-Language, and ECMA-402
> DefaultLocale() to agree with each other.

It confuses me why you would want to have those three to agree.

• navigator.language is the language of the interface
• HTTP Accept-Language is the language of content
• ECMA-402 DefaultLocale() is the user's locale

To me, these seem like completely different things. For example, I am
currently on a computer in Germany where LANG is de_DE.UTF-8, but my
browser uses HTTP Accept-Language to display web sites in English.

> Alexey has raised the point that “English as spoken in Poland” /
> “English with a Polish locale” is not a language, and is a potentially
> surprising value. Therefore, it might risk breaking websites.

Do you have evidence for web sites being broken by this string?

> On the other hand, “en-pl” is a syntactically valid BCP 47 language
> tag, and it’s the only way to avoid incompatibility between code that
> uses ECMA-402 and code that uses navigator.language and/or HTTP
> Accept-Language.

What incompatibilities are there? I do not understand this.

> In researching this question, I discovered that lots of code uses
> navigator.language and/or HTTP Accept-Language to infer the user’s
> locale, despite the fact that language and locale are not
> equivalent. For example, the #1 search result for “infer user locale”
> is <http://www.w3.org/International/questions/qa-accept-lang-locales>,
> which states, "since many applications need to know the locale of the
> user, common practice has used Accept-Language to determine this
> information”.
>
> Regards,
> Geoff

-- 
Nils Dagsson Moskopp // erlehmann
<http://dieweltistgarnichtso.net>
Received on Monday, 23 May 2016 23:56:46 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:38 UTC