[whatwg] Client side value for language preference

Matthew Nuzum newz at bearfruit.org
Fri Mar 30 07:08:09 PDT 2012


On Fri, Mar 30, 2012 at 8:11 AM, Henri Sivonen <hsivonen at iki.fi> wrote:
> On Thu, Mar 29, 2012 at 10:02 PM, Matthew Nuzum <newz at bearfruit.org> wrote:
>> Some browsers have gotten smarter and now send the first value from
>> the user's language preference, which is definitely an improvement. I
>> suspect this was done in order to preserve backwards compatibility, so
>> much of the useful information is left out.
> ...
>> navigator.language.preference = [{lang:'en-gb', weight: 0.7},{lang:
>> 'en-us', weight: 0.7},{lang:'en', weight: 0.3}];
>
> Is there a reason to believe that this client-side solution would be
> used significantly considering that the HTTP header has not been used
> that much?

I've used the HTTP header numerous times and I know many people that
have. It is so commonly used that Apache even has built in support to
make use of it when serving content.

For example, if you visit http://start.ubuntu.com/9.04/ you'll be
presented with a page that is probably in your language (we translated
it into 42 languages). The way the content negotiation feature of
Apache works is that you name pages in a pattern like this:
index.html.en, index.html.fi, etc. You can see how we did that here:
http://bazaar.launchpad.net/~ubuntu-start-page/ubuntu-start-page/trunk/files/head:/www/9.04/

It's quite easy to make use of this feature and I think it might be
more commonly done than you suspect. And if we were to make it even
easier to do I think that it would increase in use.

For example, maybe a site can't afford translation but a small library
could be included that formats dates and numbers based on a user's
language preference. No more wondering if 2/3/12 is in March or in
February.

-- 
Matthew Nuzum
newz2000 on freenode, skype, linkedin and twitter

♫ You're never fully dressed without a smile! ♫



More information about the whatwg mailing list