I18Nv2
[ class tree: I18Nv2 ] [ index: I18Nv2 ] [ all elements ]

Class: I18Nv2_Negotiator

Source Location: /I18Nv2-0.1.0/Negotiator.php

Class Overview


I18Nv2_Negotiator


Author(s):

Version:

  • $Revision: 1.1 $

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 57]
I18Nv2_Negotiator


1 //instantiate I18Nv2_Negotiator
2 $negotiator = & new I18Nv2_Negotiator();
3
4 //define which language[s] your site supports optional
5 $supportLangs = array('fr','jp');
6
7 //find first matched language
8 $lang = $negotiator->getLanguageMatch($supportLangs);
9
10 //define which countries your site supports optional
11 $supportCountries = array('gb','us');
12
13 //find first matched Country
14 $countryCode = $negotiator->getCountryMatch($lang, $supportCountries);
15
16 echo '
17 Language Code: ' . $lang.'
18 Language Name: ' . $negotiator->getLanguageName($lang).'
19 Country Code: ' . $countryCode.'
20 Country Name: ' . $negotiator->getCountryName($countryCode);



[ Top ]


Class Variables

$I18NCountry =  null

[line 73]

I18Nv2_Country
  • Access: public

Type:   object


[ Top ]

$I18Nv2Lang =  null

[line 65]

I18Nv2_Language
  • Access: public

Type:   object


[ Top ]



Method Detail

I18Nv2_Negotiator (Constructor)   [line 143]

object I18Nv2_Negotiator I18Nv2_Negotiator( [string $defaultLanguage = 'en'], [string $defaultCharset = 'iso-8859-1'], [string $defaultCountry = ''])

Constructor

Find language code, country code, charset code, and dialect or variant of Locale setting in HTTP request headers.

  • Access: public

Parameters:

string   $defaultLanguage     Default Language
string   $defaultCharset     Default Charset
string   $defaultCountry     Default Country

[ Top ]

createI18NCountry   [line 357]

object &createI18NCountry( )

Create the Country helper object
  • Access: public

[ Top ]

createI18NLanguage   [line 342]

object &createI18NLanguage( )

Create the Language helper object
  • Access: public

[ Top ]

getCharsetMatch   [line 246]

string getCharsetMatch( [array $charsets = null])

Find Charset match
  • Access: public

Parameters:

array   $charsets     

[ Top ]

getCountryMatch   [line 217]

array getCountryMatch( string $lang, [array $countries = null])

Find Country Match
  • Access: public

Parameters:

string   $lang     
array   $countries     

[ Top ]

getLanguageMatch   [line 262]

string getLanguageMatch( [array $langs = null])

Find Language match
  • Access: public

Parameters:

array   $langs     

[ Top ]

getLocaleMatch   [line 279]

string getLocaleMatch( [array $langs = null], [array $countries = null])

Find locale match
  • Access: public

Parameters:

array   $langs     
array   $countries     

[ Top ]

getVariantInfo   [line 233]

string getVariantInfo( string $lang)

Return variant info for passed parameter.
  • Access: public

Parameters:

string   $lang     

[ Top ]


Documentation generated on Sat, 1 May 2004 03:25:21 +0200 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.