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

2016-05-24 Thread Михаил Гаврилов
I propose to standardize locale settings (datetime,  number
delimeters) can be specified only by user via the operating system
settings. Sites should not change the locale that the user has chosen
for himself.

--
Best Regards,
Mike Gavrilov.


2016-05-25 10:15 GMT+05:00 Anne van Kesteren :
> On Wed, May 25, 2016 at 4:50 AM, Geoffrey Garen  wrote:
>> My claim is that if you want English language with Russian regional settings 
>> then browsers must report “en-ru” in navigator.language.
>
> That doesn't work. What if you want British English and the Russian
> locale? Or Canadian French with the US locale? A language tag already
> uses that syntax to mean something else. You can't just repurpose it
> to indicate locale.
>
>
> --
> https://annevankesteren.nl/


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

2016-05-24 Thread Anne van Kesteren
On Wed, May 25, 2016 at 4:50 AM, Geoffrey Garen  wrote:
> My claim is that if you want English language with Russian regional settings 
> then browsers must report “en-ru” in navigator.language.

That doesn't work. What if you want British English and the Russian
locale? Or Canadian French with the US locale? A language tag already
uses that syntax to mean something else. You can't just repurpose it
to indicate locale.


-- 
https://annevankesteren.nl/


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

2016-05-24 Thread Geoffrey Garen
> I'm afraid that bind regional setting to interface language is not
> correct. For example, I prefer the English language interface (it's
> easier to write bug reports, search in Google documentation), but I
> need the russian regional settings (number format, date format and
> time format) for input controls. Expected behaiour that regional
> settings would be inherited from OS settings.

My claim is that if you want English language with Russian regional settings 
then browsers must report “en-ru” in navigator.language.

My reasoning is that many website authors use navigator.language to infer 
locale. So, if navigator.language reports “en-us”, you will get US regional 
settings on many websites.

Geoff

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

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

We want them to agree because old code has been written to infer locale based 
on navigator.language, while new code will be written to infer locale based on 
EMCA-402, and we don’t want a webpage to display two distinct localizations 
simply because two library authors adopted two distinct APIs.

> • navigator.language is the language of the interface
> • HTTP Accept-Language is the language of content

I don’t think this is correct.

As Anne points out later, these two values *should* agree with each other 
according to HTML.

> • 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?

No.

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

Let’s say that my system is set up for English language with Polish locale. 
ECMA-402 APIs honors this setup. But navigator.language reports “en-us”.

Now I navigate to a news website with ads. The news website author uses 
navigator.language to infer my locale but the ad author uses ECMA-402. So, all 
the dates on the news stories display as MM/DD/YYY while all the dates on the 
ads display as DD/MM/. This is a bad experience. 

If navigator.language reported “en-pl”, all my dates would display as 
DD/MM/. This is a good experience.

Geoff

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

2016-05-24 Thread Михаил Гаврилов
I'm afraid that bind regional setting to interface language is not
correct. For example, I prefer the English language interface (it's
easier to write bug reports, search in Google documentation), but I
need the russian regional settings (number format, date format and
time format) for input controls. Expected behaiour that regional
settings would be inherited from OS settings.




--
Best Regards,
Mike Gavrilov.


2016-05-24 11:08 GMT+05:00 Anne van Kesteren :
> On Tue, May 24, 2016 at 1:55 AM, Nils Dagsson Moskopp
>  wrote:
>> • navigator.language is the language of the interface
>> • HTTP Accept-Language is the language of content
>> • ECMA-402 DefaultLocale() is the user's locale
>
> The HTML Standard has a should-level requirement for the first two to
> align, to avoid fingerprinting vectors. Also, Accept-Language is the
> desired language, it's a request header, which navigator.language is
> just the API for (and navigator.languages is the more complete API
> for). Perhaps you're thinking of Content-Language.
>
>
> --
> https://annevankesteren.nl/


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

2016-05-24 Thread Anne van Kesteren
On Tue, May 24, 2016 at 1:55 AM, Nils Dagsson Moskopp
 wrote:
> • navigator.language is the language of the interface
> • HTTP Accept-Language is the language of content
> • ECMA-402 DefaultLocale() is the user's locale

The HTML Standard has a should-level requirement for the first two to
align, to avoid fingerprinting vectors. Also, Accept-Language is the
desired language, it's a request header, which navigator.language is
just the API for (and navigator.languages is the more complete API
for). Perhaps you're thinking of Content-Language.


-- 
https://annevankesteren.nl/


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

2016-05-24 Thread Anne van Kesteren
On Mon, May 23, 2016 at 11:58 PM, Geoffrey Garen  wrote:
> For example, if I speak English but I like Polish number formatting, should 
> navigator.language report “en-pl”?

I don't think so. That would only make sense if English was a language
spoken in Poland that differs from other English languages. Contrast
with en-GB and en-US which would make sense as values and don't imply
a locale necessarily.


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

I don't think we expose locale currently, although I have not studied
ECMA-402 in detail which I suspect might reveal some of it, only the
language.


-- 
https://annevankesteren.nl/