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

2016-06-01 Thread Domenic Denicola
From: whatwg [mailto:whatwg-boun...@lists.whatwg.org] On Behalf Of Geoffrey 
Garen

> Should navigator.language and/or HTTP Accept-Language include my locale in
> addition to my language — even if the combination is exotic?

It seems like there was a good discussion on this thread but not much in the 
way of conclusion.

My take on this is that ECMA-402's DefaultLocale() is locale, whereas 
navigator.language/HTTP Accept-Language is language, and they should stay 
separate. navigator.language should continue reflecting language settings.

However, I think there's definite interest in reflecting locale settings as 
well. I don't think that this is best captured by a simple language tag string. 
Instead, as discussed in https://github.com/whatwg/html/issues/171 briefly, I 
think you want a structured object (`navigator.locales` is the proposal) that 
contains all the different extensions and thus allows you to figure out 
different settings like time formatting, date formatting, etc.

For example, as with many geeks, I set my OS to 24-hour time and -MM-DD 
date format. But my language is still en-US, and we shouldn't try to find some 
language tag that reflects my settings and call it the "locale". We should just 
reflect the settings directly.

I last talked about this in some detail with Dan Ehrenberg of the V8 team and 
Caridy Patiño, one of the editors of ECMA-402. We were roughly aligned on the 
direction but I can't find any record of our conversations, and it looks like 
there hasn't been much spec movement either. If this is something Apple is 
interested in, I can work with Caridy on a more complete spec proposal for 
`navigator.locales` and how it interacts with 402.

What do you think?



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

2016-05-25 Thread Chaals McCathie Nevile
On Wed, 25 May 2016 23:56:09 +0100, Nils Dagsson Moskopp  
 wrote:



Anne van Kesteren  writes:


On Wed, May 25, 2016 at 7:32 AM, Михаил Гаврилов
 wrote:

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.


There is a proposal to do that at
https://github.com/whatwg/html/issues/171 but it has not meaningfully
progressed thus far.

Note also that some sites go out of their way to localize form
controls to fit the language of the site. To the extent they will use
libraries rather than  and friends. Arguably they're wrong, but
there are cases where that does make sense. And let's not forget that
users often forget to set these settings properly, that's probably
part of the reason why sites do that kind of thing.


In my experience, the “users might have forgotten to set this, so we
default to something that is not what the user asked for and create a
better user experience” is something that is often invoked by developers
that do this stuff, but I have never seen data for/against the claim. Do
you have evidence for/against it improving user experience on web pages?


I don't *have* evidence I can share, but I have *seen* clear evidence that  
language settings for english in particular are seriously likely not to be  
representative of the people who have them.


Which is hearsay, of course. I would be very happy if someone can share  
clear evidence, but I'm prepared to accept the claim otherwise.


cheers

--
Charles McCathie Nevile - web standards - CTO Office, Yandex
 cha...@yandex-team.ru - - - Find more at http://yandex.com


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

2016-05-25 Thread Nils Dagsson Moskopp
Anne van Kesteren  writes:

> On Wed, May 25, 2016 at 7:32 AM, Михаил Гаврилов
>  wrote:
>> 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.
>
> There is a proposal to do that at
> https://github.com/whatwg/html/issues/171 but it has not meaningfully
> progressed thus far.
>
> Note also that some sites go out of their way to localize form
> controls to fit the language of the site. To the extent they will use
> libraries rather than  and friends. Arguably they're wrong, but
> there are cases where that does make sense. And let's not forget that
> users often forget to set these settings properly, that's probably
> part of the reason why sites do that kind of thing.

In my experience, the “users might have forgotten to set this, so we
default to something that is not what the user asked for and create a
better user experience” is something that is often invoked by developers
that do this stuff, but I have never seen data for/against the claim. Do
you have evidence for/against it improving user experience on web pages?

-- 
Nils Dagsson Moskopp // erlehmann



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/


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