Subversion Repositories Applications.papyrus

Rev

Rev 1688 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1463 alexandre_ 1
<?php
2
 
3
/**
4
* Using I18Nv2_Negotiator
5
* =======================
6
*
7
* I18Nv2 provides a language, charset and locale negotiator for HTTP.
8
*
9
* $Id: using_I18Nv2_Negotiator.php,v 1.1 2007-06-25 09:55:25 alexandre_tb Exp $
10
*/
11
 
12
require_once 'I18Nv2/Negotiator.php';
13
 
14
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'en-US,en-GB,en;q=0.5,de';
15
$_SERVER['HTTP_ACCEPT_CHARSET']  = 'utf-8,iso-8859-1;q=0.5';
16
 
17
$neg = &new I18Nv2_Negotiator;
18
 
19
echo "User agents preferred language:                  ",
20
    $lang = $neg->getLanguageMatch(), "\n";
21
 
22
echo "User agents preferred country for language '$lang': ",
23
    $neg->getCountryMatch($lang), "\n";
24
 
25
echo "User agents preferred locale:                    ",
26
    $neg->getLocaleMatch(), "\n";
27
 
28
echo "User agents preferred charset:                   ",
29
    $neg->getCharsetMatch(), "\n";
30
 
31
?>