[whatwg] Proposal: Locale Preferences API

Ian Hickson ian at hixie.ch
Mon Mar 17 11:49:10 PDT 2014


On Tue, 17 Dec 2013, Mark Callow wrote:
> > On 2013/10/15 6:24, Marcos Caceres wrote:
> >> On Friday, July 26, 2013 at 8:14 PM, Marcos Caceres wrote:
> >>
> >>> This document proposes an extension to HTML's `Navigator` interface 
> >>> to enable dynamic localization of content. The idea is to expose to 
> >>> script the language tags that represents the user's locale 
> >>> preferences (akin to the language tags that are normally sent with 
> >>> HTTP's `Accept-Languages` header).
> >
> > My question is "will anyone use it?" In my experience most web sites 
> > ignore the Accept-Languages header. I am continually being served 
> > pages in Japanese even though English is the top language in my accept 
> > list.

It's a good question.


> > There are only two reasons I can think of for this happening:
> >
> >   * sites are choosing the language based on the location of my IP
> >     address.

This is almost certainly the cause.


> >   * sites are choosing the language based on my OS locale setting.
> >     though I'm pretty sure I've been served Japanese pages on systems
> >     where it is not set to JA plus I don't know if that is visible to
> >     either server or application.

I don't think this is visible to the page currently, except indirectly 
via navigator.language, so if your browser is configured to only report 
English, that's all the page should see.


The feature requested in this thread did end up being added to the spec:

   http://whatwg.org/html#language-preferences

It's basically just an array version of navigator.language, and the spec 
suggests using the same list as for Accept-Language, so it doesn't really 
provide anything new, it's just more convenient.

It's true that Accept-Language doesn't seem to have been widely used. The 
feature was primarily added due to requests from implementors. I don't 
know what we can do to cause authors to rely on this API and its siblings 
rather than on IP geolocation.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list