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

2016-05-23 Thread Nils Dagsson Moskopp
Geoffrey Garen  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 ,
> 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



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

2016-05-23 Thread Geoffrey Garen
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.

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.

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.

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 
, 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