cvs: peardoc /en/package/http/http negotiatelanguage.xml

From: Date: Tue, 25 Nov 2003 21:59:15 +0000
Subject: cvs: peardoc /en/package/http/http negotiatelanguage.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-2013@lists.php.net to get a copy of this message
mj Tue Nov 25 16:59:15 2003 EDT Modified files: /peardoc/en/package/http/http negotiatelanguage.xml Log: * Another example Index: peardoc/en/package/http/http/negotiatelanguage.xml diff -u peardoc/en/package/http/http/negotiatelanguage.xml:1.4 peardoc/en/package/http/http/negotiatelanguage.xml:1.5 --- peardoc/en/package/http/http/negotiatelanguage.xml:1.4 Wed Aug 13 12:01:04 2003 +++ peardoc/en/package/http/http/negotiatelanguage.xml Tue Nov 25 16:59:14 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <refentry id="package.http.http.negotiatelanguage"> <refnamediv> <refname>HTTP::negotiateLanguage</refname> @@ -36,6 +36,36 @@ </programlisting> </para> </refsect1> + <refsect1 id="package.http.http.negotiatelanguage.example"> + &title.example; + <para> + <example> + <title>Usage example</title> + <programlisting role="php"> +require_once "HTTP.php"; + +$supported = array("de" => true, "en-US" => true); + +echo HTTP::negotiateLanguage($supported); + </programlisting> + </example> + </para> + <para> + This example negotiates with the user agent if any of the + languages, which are specified in <varname>supported</varname>, + are supported on the user's system. If the negotiation has a + positive result, the language code of the most preferred language + is printed. Otherwise the default language code (en-US) is + printed. + </para> + <para> + Being able to perform language negotiation is a big help when + developing internationalized website with pages, that are available + in more than one language. Using negotiation, the user will always + get pages in the language which he prefers. (Assuming that their + user agent is configured properly.) + </para> + </refsect1> <refsect1 id="package.http.http.negotiatelanguage.parameter"> &title.param; <para>

« previous php.pear.doc (#2013) next »