## Class CultureInfo

Description

CultureInfo class.

Represents information about a specific culture including the names of the culture, the calendar used, as well as access to culture-specific objects that provide methods for common operations, such as formatting dates, numbers, and currency.

The CultureInfo class holds culture-specific information, such as the associated language, sublanguage, country/region, calendar, and cultural conventions. This class also provides access to culture-specific instances of DateTimeFormatInfo and NumberFormatInfo. These objects contain the information required for culture-specific operations, such as formatting dates, numbers and currency.

The culture names follow the format "<languagecode>_<country/regioncode>", where <languagecode> is a lowercase two-letter code derived from ISO 639 codes. You can find a full list of the ISO-639 codes at http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt

The <country/regioncode2> is an uppercase two-letter code derived from ISO 3166. A copy of ISO-3166 can be found at http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html

For example, Australian English is "en_AU".

- version: v1.0, last update on Sat Dec 04 13:41:46 EST 2004
- author: Xiang Wei Zhuo <weizhuo[at]gmail[dot]com>

Located in /I18N/core/CultureInfo.php (line 50)

Class Constant Summary
ALL = 0
NEUTRAL = 1
SPECIFIC = 2
Variable Summary
array $properties
Method Summary
return __construct ([string $culture = 'en'])
string dataDir ()
string fileExt ()
mixed findInfo ([string $path = '/'], [boolean $merge = false])
string getCalendar ()
array getCountries ()
array getCultures ([int $type = CultureInfo::ALL])
array getCurrencies ()
array &getData (string $filename)
DateTimeFormatInfo getDateTimeFormat ()
array getEnglishName ()
CultureInfo getInvariantCulture ()
boolean getIsNeutralCulture ()
array getLanguages ()
string getName ()
array getNativeName ()
NumberFormatInfo getNumberFormat ()
CultureInfo getParent ()
array getScripts ()
array getTimeZones ()
void loadCultureData (string $culture)
void setCulture (string $culture)
void setDateTimeFormat (DateTimeFormatInfo $dateTimeFormat)
void setNumberFormat (NumberFormatInfo $numberFormat)
boolean validCulture (string $culture)
mixed __get (mixed $name)
void __set (mixed $name, mixed $value)
string __toString ()
Variables
array $properties = array() (line 98)

A list of properties that are accessable/writable.

- access: protected

Methods
Constructor __construct (line 168)

Initializes a new instance of the CultureInfo class based on the culture specified by name. E.g.

- return: new CultureInfo.

return __construct ([string $culture = 'en'])

- string $culture: a culture name, e.g. "en_AU".

dataDir (line 189)

Get the default directory for the ICU data.

The default is the "data" directory for this class.

- return: directory containing the ICU data.
- static:
- access: protected

string dataDir ()
fileExt (line 198)

Get the filename extension for ICU data. Default is ".dat".

- return: filename extension for ICU data.
- static:
- access: protected

string fileExt ()
findInfo (line 306)

Find the specific ICU data information from the data.

The path to the specific ICU data is separated with a slash "/". E.g. To find the default calendar used by the culture, the path "calendar/default" will return the corresponding default calendar. Use merge=true to return the ICU including the parent culture. E.g. The currency data for a variant, say "en_AU" contains one entry, the currency for AUD, the other currency data are stored in the "en" data file. Thus to retrieve all the data regarding currency for "en_AU", you need to use findInfo("Currencies,true);.

- return: the specific ICU data.
- access: protected

mixed findInfo ([string $path = '/'], [boolean $merge = false])

- string $path: the data you want to find.
- boolean $merge: merge the data from its parents.

getCalendar (line 389)

Gets the default calendar used by the culture, e.g. "gregorian".

- return: the default calendar.

string getCalendar ()
getCountries (line 576)

Get a list of countries in the language of the localized version.

- return: a list of localized country names.

array getCountries ()
getCultures (line 512)

Gets the list of supported cultures filtered by the specified culture type. This is an EXPENSIVE function, it needs to traverse a list of ICU files in the data directory.

This function can be called statically.

- return: list of culture information available.
- static:

array getCultures ([int $type = CultureInfo::ALL])

- int $type: culture type, CultureInfo::ALL, CultureInfo::NEUTRAL or CultureInfo::SPECIFIC.

getCurrencies (line 585)

Get a list of currencies in the language of the localized version.

- return: a list of localized currencies.

array getCurrencies ()
getData (line 278)

Get the data by unserializing the ICU data from disk.

The data files are cached in a static variable inside this function.

- return: ICU data
- access: protected

array &getData (string $filename)

- string $filename: the ICU data filename

getDateTimeFormat (line 364)

Gets the DateTimeFormatInfo that defines the culturally appropriate format of displaying dates and times.

- return: date time format information for the culture.

DateTimeFormatInfo getDateTimeFormat ()
getEnglishName (line 419)

Gets the culture name in English.

Returns

    array('Language','Country');

'Country' is omitted if the culture is neutral.

- return: array with language and country as elements.

array getEnglishName ()
getInvariantCulture (line 440)

Gets the CultureInfo that is culture-independent (invariant).

Any changes to the invariant culture affects all other instances of the invariant culture. The invariant culture is assumed to be "en";

- return: invariant culture info is "en".
- static:

CultureInfo getInvariantCulture ()
getIsNeutralCulture (line 454)

Gets a value indicating whether the current CultureInfo represents a neutral culture. Returns true if the culture only contains two characters.

- return: true if culture is neutral, false otherwise.

boolean getIsNeutralCulture ()
getLanguages (line 594)

Get a list of languages in the language of the localized version.

- return: list of localized language names.

array getLanguages ()
getName (line 354)

Gets the culture name in the format "<languagecode2>_(country/regioncode2)".

- return: culture name.

string getName ()
getNativeName (line 401)

Gets the culture name in the language that the culture is set to display. Returns

    array('Language','Country');

'Country' is omitted if the culture is neutral.

- return: array with language and country as elements, localized.

array getNativeName ()
getNumberFormat (line 464)

Gets the NumberFormatInfo that defines the culturally appropriate format of displaying numbers, currency, and percentage.

- return: the number format info for current culture.

NumberFormatInfo getNumberFormat ()
getParent (line 494)

Gets the CultureInfo that represents the parent culture of the

current CultureInfo

- return: parent culture information.

CultureInfo getParent ()
getScripts (line 603)

Get a list of scripts in the language of the localized version.

- return: list of localized script names.

array getScripts ()
getTimeZones (line 612)

Get a list of timezones in the language of the localized version.

- return: list of localized timezones.

array getTimeZones ()
loadCultureData (line 237)

Load the ICU culture data for the specific culture identifier.

- access: protected

void loadCultureData (string $culture)

- string $culture: the culture identifier.

setCulture (line 222)

Set the culture for the current instance. The culture indentifier must be of the form "<language>_(country/region)".

- access: protected

void setCulture (string $culture)

- string $culture: culture identifier, e.g. "fr_FR_EURO".

setDateTimeFormat (line 380)

Set the date time format information.

void setDateTimeFormat (DateTimeFormatInfo $dateTimeFormat)

- DateTimeFormatInfo $dateTimeFormat: the new date time format info.

setNumberFormat (line 484)

Set the number format information.

void setNumberFormat (NumberFormatInfo $numberFormat)

- NumberFormatInfo $numberFormat: the new number format info.

validCulture (line 209)

Determine if a given culture is valid. Simply checks that the culture data exists.

- return: true if valid, false otherwise.
- access: public

boolean validCulture (string $culture)

- string $culture: a culture

__get (line 137)

Allow functions that begins with 'set' to be called directly as an attribute/property to retrieve the value.

mixed __get (mixed $name)
__set (line 150)

Allow functions that begins with 'set' to be called directly as an attribute/property to set the value.

void __set (mixed $name, mixed $value)
__toString (line 126)

Display the culture name.

- return: the culture name.
- see: CultureInfo::getName()

string __toString ()
Class Constants
ALL = 0 (line 105)

Culture type, all.

- see: CultureInfo::getCultures()

NEUTRAL = 1 (line 112)

Culture type, neutral.

- see: CultureInfo::getCultures()

SPECIFIC = 2 (line 119)

Culture type, specific.

- see: CultureInfo::getCultures()

Documentation generated on Mon, 01 May 2006 23:02:34 -0400 by phpDocumentor 1.3.0RC4