Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Locale.php File Reference


Detailed Description

Locale related functions.

Definition in file Locale.php.

Go to the source code of this file.

Functions

_locale ()
 _setLocale ($category, $locale)
 _getLocale ($category=LC_ALL)
_locale_cache ()
 _parseLocale ($locale=null)
 getLocale ($category=LC_ALL, $locale=null)
 _get ($category=LC_ALL, $locale=null, $key= 'locale')
 getLanguageID ($category=LC_ALL, $locale=null)
 getLanguageName ($category=LC_ALL, $locale=null)
 getCountryID ($category=LC_ALL, $locale=null)
 getCountryName ($category=LC_ALL, $locale=null)
 getCharset ($category=LC_ALL, $locale=null)
 getCodepage ($category=LC_ALL, $locale=null)
 getDefaultLanguageID ()
 getDefaultLanguageName ()
 getDefaultCountryID ()
 getDefaultCountryName ()
 getDefaultCharset ()
 getDefaultCodepage ()
 _guessLocale ()
 getDefaultLocale ()
 _setLocaleWindows ($category, $locale)
 setLocale ($category, $locales)
 _localeStack ($category, $locale=null)
 pushLocale ($category, $locale)
 popLocale ($category)
parseAcceptLanguages ($http_accept_language=null)
getAvailableLocales ($dir=null)
 getNearestLocales ($locales)
 numberFormat ($number, $digits=null, $locale=null)
 moneyFormat ($number, $digits=null, $locale=null)


Function Documentation

_get category = LC_ALL,
locale = null,
key = 'locale'
[static, private]
 

Parameters:
$category int (LC_ALL (default), LC_COLLATE, LC_TYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME)
$locale string (default is current locale) locale string
$key string (locale, language_id, language, country_id, country, charset or codepage)
Returns:
string

Definition at line 364 of file Locale.php.

References _locale_cache(), and getLocale().

Referenced by getCharset(), getCodepage(), getCountryID(), getCountryName(), getDefaultCharset(), getDefaultCodepage(), getDefaultCountryID(), getDefaultCountryName(), getDefaultLanguageID(), getDefaultLanguageName(), getLanguageID(), and getLanguageName().

_getLocale category = LC_ALL  )  [static]
 

Parameters:
$category int (LC_ALL (default), LC_COLLATE, LC_TYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME)
Returns:
string

Definition at line 144 of file Locale.php.

References _locale(), fbDebug::enter(), and fbDebug::leave().

Referenced by _guessLocale(), _parseLocale(), getDefaultLocale(), getLocale(), and pushLocale().

_guessLocale  )  [static, private]
 

If setlocale() returns 'C', _guessLocale() determines the current locale by comparing all the long month names returned by strftime against a known list.

Returns:
array

Todo:
TA for Tatar?

fixme

Look up country_id using fbISO639_ISO3166_Map::getCountryID()?

default to ISO8559-1 charset?

default to 1252 codepage?

Definition at line 492 of file Locale.php.

References _getLocale(), fbDebug::enter(), getLanguageName(), and fbDateTime::getLongMonthNames().

Referenced by getDefaultLocale().

& _locale  )  [static, private]
 

Returns:
array

Definition at line 77 of file Locale.php.

References _locale().

Referenced by _getLocale(), _locale(), _setLocale(), getDefaultLocale(), and numberFormat().

& _locale_cache  )  [static, private]
 

Returns:
array

Definition at line 158 of file Locale.php.

Referenced by _get(), getDefaultLocale(), getLocale(), and setLocale().

_localeStack category,
locale = null
[static, private]
 

Parameters:
$category int (LC_ALL, LC_COLLATE, LC_TYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME)
$locale string locale string (optional)
Returns:
mixed

Definition at line 782 of file Locale.php.

References fbDebug::enter().

Referenced by popLocale(), and pushLocale().

_parseLocale locale = null  )  [static, private]
 

Parses locale string returned by setlocale().

Returns a hash.

For example, _parseLocale('en_US.ISO8859-1') returns:

array( 'locale' => 'en_US.ISO8859-1', 'language_id' => 'EN', 'language' => 'English', 'country_id' => 'US', 'country' => 'United States', 'charset' => 'ISO8859-1', 'codepage' => '1252', );

This function can parse Windows locales as well.

For example, _parseLocale('English_United Kingdom.1252') returns:

array( 'locale' => 'en_GB.ISO8859-1', 'language_id' => 'EN', 'language' => 'English', 'country_id' => 'GB', 'country' => 'United Kingdom', 'charset' => 'ISO8859-1', 'codepage' => '1252', );

Parameters:
$locale string (default is current locale) locale string
Returns:
hash

Todo:
Determine correct charset for 1253

deal with ll-CC

Definition at line 200 of file Locale.php.

References _getLocale(), getCountryName(), and getLanguageName().

Referenced by getDefaultLocale(), getLocale(), and setLocale().

_setLocale category,
locale
[static, private]
 

Parameters:
$category int (LC_ALL (default), LC_COLLATE, LC_TYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME)
$locale string (default is current locale) locale string
Returns:
string

Todo:
TEST!

log setlocale() failure?

Definition at line 101 of file Locale.php.

References _locale(), fbDebug::enter(), and fbDebug::leave().

Referenced by _setLocaleWindows(), getDefaultLocale(), popLocale(), and setLocale().

_setLocaleWindows category,
locale
[static, private]
 

Parameters:
$category int (LC_ALL, LC_COLLATE, LC_TYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME)
$locale mixed locale string or array of strings
Returns:
string

Definition at line 652 of file Locale.php.

References _setLocale(), fbDebug::dump(), fbDebug::enter(), getLanguageID(), getLanguageName(), and fbDebug::leave().

Referenced by setLocale().

& getAvailableLocales dir = null  )  [static]
 

Todo:
move to fbGetText
Parameters:
$dir string
Returns:
array

Definition at line 904 of file Locale.php.

References fbDebug::enter(), and fbDebug::leave().

Referenced by getNearestLocales().

getCharset category = LC_ALL,
locale = null
[static]
 

Parameters:
$category int (LC_ALL (default), LC_COLLATE, LC_TYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME)
$locale string (default is current locale) locale string
Returns:
string

Definition at line 422 of file Locale.php.

References _get().

getCodepage category = LC_ALL,
locale = null
[static]
 

Parameters:
$category int (LC_ALL (default), LC_COLLATE, LC_TYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME)
$locale string (default is current locale) locale string
Returns:
string

Definition at line 432 of file Locale.php.

References _get().

getCountryID category = LC_ALL,
locale = null
[static]
 

Parameters:
$category int (LC_ALL (default), LC_COLLATE, LC_TYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME)
$locale string (default is current locale) locale string
Returns:
string

Definition at line 402 of file Locale.php.

References _get().

getCountryName category = LC_ALL,
locale = null
[static]
 

Parameters:
$category int (LC_ALL (default), LC_COLLATE, LC_TYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME)
$locale string (default is current locale) locale string
Returns:
string

Definition at line 412 of file Locale.php.

References _get().

Referenced by _parseLocale(), fbGeoIP_Free::getCountryNameByHostName(), fbGeoIP_Free_Binary::getCountryNameByHostName(), fbGeoIP_Free_Ascii::getCountryNameByHostName(), fbGeoIP_Free::getCountryNameByIP(), fbGeoIP_Free_Binary::getCountryNameByIP(), and fbGeoIP_Free_Ascii::getCountryNameByIP().

getDefaultCharset  )  [static]
 

Returns:
string

Definition at line 472 of file Locale.php.

References _get().

getDefaultCodepage  )  [static]
 

Returns:
string

Definition at line 480 of file Locale.php.

References _get().

getDefaultCountryID  )  [static]
 

Returns:
string

Definition at line 456 of file Locale.php.

References _get().

getDefaultCountryName  )  [static]
 

Returns:
string

Definition at line 464 of file Locale.php.

References _get().

getDefaultLanguageID  )  [static]
 

Returns:
string

Definition at line 440 of file Locale.php.

References _get().

getDefaultLanguageName  )  [static]
 

Returns:
string

Definition at line 448 of file Locale.php.

References _get().

getDefaultLocale  )  [static]
 

If setlocale() returns false or 'C', getDefaultLocale() determines the current locale by comparing all the long month names returned by strftime against a known list.

Returns:
string

Definition at line 594 of file Locale.php.

References _getLocale(), _guessLocale(), _locale(), _locale_cache(), _parseLocale(), _setLocale(), fbDebug::dump(), fbDebug::enter(), and fbDebug::leave().

Referenced by getLocale().

getLanguageID category = LC_ALL,
locale = null
[static]
 

Parameters:
$category int (LC_ALL (default), LC_COLLATE, LC_TYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME)
$locale string (default is current locale) locale string
Returns:
string

Definition at line 382 of file Locale.php.

References _get().

Referenced by _setLocaleWindows().

getLanguageName category = LC_ALL,
locale = null
[static]
 

Parameters:
$category int (LC_ALL (default), LC_COLLATE, LC_TYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME)
$locale string (default is current locale) locale string
Returns:
string

Definition at line 392 of file Locale.php.

References _get().

Referenced by _guessLocale(), _parseLocale(), and _setLocaleWindows().

getLocale category = LC_ALL,
locale = null
[static]
 

Parameters:
$category int (LC_ALL (default), LC_COLLATE, LC_TYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME)
$locale string (default is current locale) locale string
Returns:
string

Definition at line 320 of file Locale.php.

References _getLocale(), _locale_cache(), _parseLocale(), fbDebug::dump(), fbDebug::enter(), getDefaultLocale(), and fbDebug::leave().

Referenced by _get(), fbDateTime::_getDateNames(), fbGettext::_loadData(), fbDateTime::getDateOrder(), fbGettext::gettext(), and numberFormat().

getNearestLocales locales  )  [static]
 

Todo:
support multiple locales
Parameters:
$locales mixed A single locale, or an array of locales
Returns:
string

Definition at line 940 of file Locale.php.

References fbDebug::dump(), fbDebug::enter(), getAvailableLocales(), and fbDebug::leave().

Referenced by fbGettext::_loadData().

moneyFormat number,
digits = null,
locale = null
 

Todo:
implment fbLocale::moneyFormat()

Definition at line 1105 of file Locale.php.

numberFormat number,
digits = null,
locale = null
[static]
 

decimal_point Decimal point character thousands_sep Thousands separator

grouping Array containing numeric groupings

int_curr_symbol International currency symbol (i.e. USD) currency_symbol Local currency symbol (i.e. $)

mon_decimal_point Monetary decimal point character mon_thousands_sep Monetary thousands separator mon_grouping Array containing monetary groupings

positive_sign Sign for positive values negative_sign Sign for negative values

int_frac_digits International fractional digits frac_digits Local fractional digits

p_cs_precedes TRUE if currency_symbol precedes a positive value, FALSE if it succeeds one p_sep_by_space TRUE if a space separates currency_symbol from a positive value, FALSE otherwise n_cs_precedes TRUE if currency_symbol precedes a negative value, FALSE if it succeeds one n_sep_by_space TRUE if a space separates currency_symbol from a negative value, FALSE otherwise

p_sign_posn 0 The sign string succeeds the quantity and currency_symbol 3 Parentheses surround the quantity and currency_symbol 1 The sign string immediately precedes the currency_symbol 4 The sign string precedes the quantity and currency_symbol 2 The sign string immediately succeeds the currency_symbol n_sign_posn 0 The sign string succeeds the quantity and currency_symbol 3 Parentheses surround the quantity and currency_symbol 1 The sign string immediately precedes the currency_symbol 4 The sign string precedes the quantity and currency_symbol 2 The sign string immediately succeeds the currency_symbol

Parameters:
$number float
$digits int
$locale string (default is current locale) locale string
Returns:
string

Definition at line 1053 of file Locale.php.

References _locale(), fbDebug::dump(), fbDebug::enter(), getLocale(), fbDebug::leave(), popLocale(), and pushLocale().

& parseAcceptLanguages http_accept_language = null  )  [static]
 

Parameters:
$http_accept_language string
Returns:
mixed

Definition at line 850 of file Locale.php.

References fbDebug::enter(), and fbDebug::leave().

popLocale category  )  [static]
 

Parameters:
$category int (LC_ALL, LC_COLLATE, LC_TYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME)
Returns:
void

Definition at line 834 of file Locale.php.

References _localeStack(), _setLocale(), fbDebug::enter(), and fbDebug::leave().

Referenced by fbDateTime::_getDateNames(), and numberFormat().

pushLocale category,
locale
[static]
 

Parameters:
$category int (LC_ALL, LC_COLLATE, LC_TYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME)
$locale string (default is current locale) locale string
Returns:
void

Definition at line 812 of file Locale.php.

References _getLocale(), _localeStack(), fbDebug::dump(), fbDebug::enter(), fbDebug::leave(), and setLocale().

Referenced by fbDateTime::_getDateNames(), and numberFormat().

setLocale category,
locales
[static]
 

Parameters:
$category int (LC_ALL, LC_COLLATE, LC_TYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME)
$locales mixed locale string or array of strings
Returns:
string

Definition at line 720 of file Locale.php.

References _locale_cache(), _parseLocale(), _setLocale(), _setLocaleWindows(), fbDebug::enter(), fbDebug::leave(), and putEnv().

Referenced by pushLocale().


Generated on Fri Mar 19 12:52:28 2004 for Freebeer by doxygen 1.3.6-20040222