Method HttpRequestMessage() :setAcceptLanguage() Foundation

Defines the accepted language for responses from the server.

Syntax
 
:setAcceptLanguage( <cLanguage> | <aLanguages> ) --> self
Parameters
<cLanguage>
A character string with a language specifier. This may either be a two- or three-character ISO language code or a full language tag which includes additional information such as the country variant (locale). Instead of specifying a specific language, the wildcard character * may be used which denotes "accepts any language".
<aLanguages>
An array of language specifiers defined as character strings of the format described for the <cLanguage> parameter. The elements in the array can optionally be weighted by using a so-called quality value. The quality value is a value between 0 and 1 denoting the language's priority. A weight value of 1 (the default) is equivalent to the highest priority.
Examples: 
:setAcceptLanguage( "de" )			// specific language 
:setAcceptLanguage( "en-US" )			// specific locale 
:setAcceptLanguage( "*" )			// wildcard (all languages accepted) 
:setAcceptLanguage( {"en-US, en;q=0.5"} )	// weighted language list 
Return

:setAcceptLanguage() returns the object executing the method.

Description

The method :setAcceptLanguage() specifies to the server which language(s) the client is able to unterstand when processing data sent by the server.

The accepted language is a discretionary element in the request header. Although servers are expected to respect the proposal(s) made by the client, there is no guarantee the response will be in the desired language. Consequently, the "Content-Language" HTTP header in the server's response should be checked prior to processing the response data. See the method :getHeaders() for further information.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.