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.


Previous Page Page 5 of 10 Next Page


Feedback Form (ExpandCollapse)

What do you think about this web page?






(Optional) Please provide us more details. For example, suppose you select option 2 above, can you tell us specifically what information is missing? You can also suggest anything that can help us improve this web page.

(Optional) Your name:

(Optional) Your email address:

Please enter again to confirm:

Due to the amount of messages we received, we may not be able to reply to all messages.

A button for going back to the top of this page