Welcome to Developer's Home Thursday, April 24, 2014
Home - DevelopersHome.com

The Accept-Language Header -- Find the Language Preference


Preferences - Do not show ads

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.


Page 5 of 10 Previous Page | Next Page
Contents at a Glance
Print this Web Page | | Back to Top
Custom Search

Feedback Form (Expand)

What do you think about this web page?






Detecting User Agent and Device Capabilities - Table of Contents Detecting User Agent and Device Capabilities - Contents at a Glance Preferences - Change Color Scheme Preferences - Do Not Show Ads Previous Page Next Page