[webkit-dev] exposing the value of Accept-Language via window.navigation.acceptLanguage ?

Jungshik Shin (신정식, 申政湜) jshin at chromium.org
Wed Jul 22 16:41:46 PDT 2009


Hi,

 I proposed exposing the values of the Accept-Langauge  list via
window.navigation.acceptLanguages at

      https://bugs.webkit.org/show_bug.cgi?id=27555

This email is to get opinions (for and against) on that in case the
bug is not noticed by many. As pointed out by ap in the bug, perhaps,
we have to bring this up in the WHATWG as well. Before I do that, it
may not be a bad idea to know what others her think about it.

Currently, the UI language of a browser is exposed with
window.navigation.language.  This can be used by a 'web application' /
widget / browser extension to 'behave differently' per the UI
language.

A lot of web servers also take into account the value of
Accept-Language HTTP header field when determining the UI language of
their web apps or the language of contents to serve when multiple
language versions exist.  Moreover, most browsers (Safari, Chrome,
Firefox, IE, and so forth) allow users to add, delete, move up and
down a language to the prioritized list of languages they understand

Some web apps/widgets/browser extensions can also benefit from knowing
the ordered list of languages in Accept-Language.

One particular use case Chrome has in mind is to determine the target
language of translation without a user-intervention.  If the source
language is A and the A-L list has {B, C, D}, the target language can
be determined by walking through the list and picking up the first
language for which the translation from A is available. If 'A' is in
the A-L list, perhaps the translation service should not be called.  (
See http://crbug.com/14574 )

There might be other cases of 'multi-lingual' applications where the
knowledge of the A-L list can be helpful.


It can be exposed by adding either of the two below to window.navigation

     readonly attribute DOMStringList acceptLanguages // a list of
language codes

     readonly attribute DOMString acceptLanguages // a comma separated
language codes

Unlike in the Accept-Language http header field, a language in the
list will not have a q-factor associated with it. Instead, they're
sorted in the descending order of the priority.


Any opinion would be welcome.

Jungshik


More information about the webkit-dev mailing list