PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

ob_deflatehandler> <http_negotiate_content_type
Last updated: Sat, 24 Mar 2007

view this page in

http_negotiate_language

(PECL pecl_http:0.1.0-1.4.1)

http_negotiate_language — Negotiate clients preferred language

Popis

string http_negotiate_language ( [array $supported [, array &$result]] )

This function negotiates the clients preferred language based on its Accept-Language HTTP header. The qualifier is recognized and languages without qualifier are rated highest. The qualifier will be decreased by 10% for partial matches (i.e. matching primary language).

Seznam parametrů

supported

Array containing the supported languages as values

result

Will be filled with an array containing the negotiation results

Návratové hodnoty

Returns the negotiated language or the default language (i.e. first array entry) if none match.

Příklady

Příklad 689. Using http_negotiate_language()

<?php
$langs
= array(
       
'en-US',// default
       
'fr',
       
'fr-FR',
       
'de',
       
'de-DE',
       
'de-AT',
       
'de-CH',
);

include
'./langs/'. http_negotiate_language($langs, $result) .'.php';

print_r($result);
?>



add a note add a note User Contributed Notes
http_negotiate_language
galosa at netinform dot hu
09-Jul-2007 11:56
See a list of the available language codes here:
http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes

ob_deflatehandler> <http_negotiate_content_type
Last updated: Sat, 24 Mar 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites