Class PHRUTS_Locale

Description

Locale

A PHRUTS_Locale object represents a specific geographical, political, or cultural region. An operation that requires a PHRUTS_Locale to perform its task is called locale-sensitive and uses the PHRUTS_Locale to tailor information for the user.

The language argument is a valid ISO Language Code. These codes are the lower-case, two-letter codes as defined by ISO-639. You can find a full list of these codes at a number of sites, such as: http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt.

The country argument is a valid ISO Country Code. These codes are the upper-case, two-letter codes as defined by ISO-3166. You can find a full list of these codes at a number of sites, such as: http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html.

The variant argument is a vendor or browser-specific code. For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX. Where there are two variants, separate them with an underscore, and put the most important one first. For example, a Traditional Spanish collation might construct a locale with parameters for language, country and variant as: "es", "ES", "Traditional_WIN".

  • author: John WILDENAUER <jwilde@users.sourceforge.net> (PHP4 port of Struts)
  • author: Olivier HENRY <oliv.henry@gmail.com> (PHP5 port of Struts)
  • version: $Id: PHRUTS_Locale.php,v 1.2 2008/05/24 13:32:44 ohenry Exp $
  • copyright: Copyright PHruts 2008

Located in /util/PHRUTS_Locale.php (line 51)


	
			
Variable Summary
Method Summary
static void setDefault (PHRUTS_Locale $newLocale)
PHRUTS_Locale __construct (string $language, [string $country = ''], [string $variant = ''])
boolean equals (object $obj)
string getCountry ()
string getLanguage ()
string getVariant ()
string __toString ()
Variables
static PHRUTS_Locale $CANADA (line 178)

PHRUTS_Locale which represents the English speaking portion of Canada.

  • access: public
static PHRUTS_Locale $CANADA_FRENCH (line 184)

PHRUTS_Locale which represents the French speaking portion of Canada.

  • access: public
static PHRUTS_Locale $CHINA (line 144)

PHRUTS_Locale which represents China.

Same as SIMPLIFIED_CHINESE PHRUTS_Locale.

  • access: public
static PHRUTS_Locale $CHINESE (line 92)

PHRUTS_Locale which represents the Chinese language.

  • access: public
static Locale $defaultLocale = null (line 212)

The default locale.

  • access: private
static PHRUTS_Locale $ENGLISH (line 56)

PHRUTS_Locale which represents the English language.

  • access: public
static PHRUTS_Locale $FRANCE (line 112)

PHRUTS_Locale which represents France.

  • access: public
static PHRUTS_Locale $FRENCH (line 62)

PHRUTS_Locale which represents the French language.

  • access: public
static PHRUTS_Locale $GERMAN (line 68)

PHRUTS_Locale which represents the German language.

  • access: public
static PHRUTS_Locale $GERMANY (line 118)

PHRUTS_Locale which represents Germany.

  • access: public
static PHRUTS_Locale $ITALIAN (line 74)

PHRUTS_Locale which represents the Italian language.

  • access: public
static PHRUTS_Locale $ITALY (line 124)

PHRUTS_Locale which represents Italy.

  • access: public
static PHRUTS_Locale $JAPAN (line 130)

PHRUTS_Locale which represents Japan.

  • access: public
static PHRUTS_Locale $JAPANESE (line 80)

PHRUTS_Locale which represents the Japanese language.

  • access: public
static PHRUTS_Locale $KOREA (line 136)

PHRUTS_Locale which represents Korea.

  • access: public
static PHRUTS_Locale $KOREAN (line 86)

PHRUTS_Locale which represents the Korean language.

  • access: public
static PHRUTS_Locale $PRC (line 152)

PHRUTS_Locale which represents the People's Republic of China.

Same as CHINA Locale.

  • access: public
static PHRUTS_Locale $SIMPLIFIED_CHINESE (line 98)

Locale which represents the Chinese language as used in China.

  • access: public
static PHRUTS_Locale $TAIWAN (line 160)

PHRUTS_Locale which represents Taiwan.

Same as TRADITIONAL_CHINESE Locale.

  • access: public
static PHRUTS_Locale $TRADITIONAL_CHINESE (line 106)

PHRUTS_Locale which represents the Chinese language as used in Taiwan.

Same as TAIWAN Locale.

  • access: public
static PHRUTS_Locale $UK (line 166)

PHRUTS_Locale which represents the United Kingdom.

  • access: public
static PHRUTS_Locale $US (line 172)

PHRUTS_Locale which represents the United States.

  • access: public
string $country = '' (line 198)

The country code, as returned by getCountry().

  • access: private
string $language = '' (line 191)

The language code, as returned by getLanguage().

  • access: private
string $variant = '' (line 205)

The variant code, as returned by getVariant().

  • access: private
Methods
static method getDefault (line 238)

Returns the default PHRUTS_Locale.

The default locale is generally once set on start up and then never changed. Normally you should use this locale for everywhere you need a locale. The initial setting matches the default locale, the user has chosen.

  • access: public
static PHRUTS_Locale getDefault ()
static method setDefault (line 249)

Changes the default locale.

Normally only called on program start up.

  • access: public
static void setDefault (PHRUTS_Locale $newLocale)
Constructor __construct (line 222)

Construct a locale from language, country, variant.

  • access: public
PHRUTS_Locale __construct (string $language, [string $country = ''], [string $variant = ''])
  • string $language: Lowercase two-letter ISO-639 A2 language code.
  • string $country: Uppercase two-letter ISO-3166 A2 country code.
  • string $variant: Vendor and browser specific code. See class description.
equals (line 313)

Compares two locales.

To be equal, obj must be a Locale with the same language, country and variant code.

  • return: True if obj is equal to this
  • access: public
boolean equals (object $obj)
  • object $obj
getCountry (line 267)

Returns the country code of this locale.

  • access: public
string getCountry ()
getLanguage (line 258)

Returns the language code of this locale.

  • access: public
string getLanguage ()
getVariant (line 276)

Returns the variant code of this locale.

  • access: public
string getVariant ()
__toString (line 290)

Gets the string representation of the current locale.

This consists of the language, the country, and the variant, separated by an underscore. The variant is listed only if there is a language or country.
Examples : 'en', 'de_DE', '_GB', 'en_US_WIN', 'de__POSIX', 'fr__MAC'

  • access: public
string __toString ()

Documentation generated on Sat, 31 May 2008 15:46:18 +0200 by phpDocumentor 1.4.1