2.4. The Accept-Language
Header -- Find the Language Preference
The
Accept-Language header
contains information about the language preference of a user. This
HTTP header is useful to multilingual sites for deciding the best
language to serve to the client. Some example Accept-Language
headers are provided below:
Nokia
6230i (the Accept-Language header value can be changed in the
Preferences dialog of the emulator):
en
Nokia
Mobile Browser 4.0:
en,
fi
Openwave
Mobile Browser 6.2.2 (the Accept-Language header value can be
changed in the Options dialog of the emulator):
en
In
the above examples, "en" means English and "fi"
means Finnish. The language code can be followed by a hyphen and then
a two-character country code. For example, "en-us" means
American English and "en-gb" means British English. The
full lists of language code and country code are available at
http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt
and http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html.
Languages
in the Accept-Language
header may be associated with a quality value that specifies the
order of preference. For example:
zh,
en-us; q=0.8, en; q=0.6
American
English (en-us) is assigned a quality value of 0.8 while English (en)
is assigned a quality value of 0.6. Since the default quality value
is 1, Chinese (zh) is assigned a quality value of 1. The whole line
means Chinese is preferred. If a Chinese version is not available,
American English is preferred. If there are no Chinese and American
English versions, other forms of English is preferred.
To
learn further details about the Accept-Language
header, please refer to the HTTP/1.1 specification at
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4.
Feedback Form (ExpandCollapse)
|
|