Class Zend_Locale

Description

Base class for localization

  • copyright: Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  • license: New BSD License

Located in /Locale.php (line 30)


	
			
Class Constant Summary
 BROWSER = 'browser'
 ENVIRONMENT = 'environment'
 ZFDEFAULT = 'default'
Variable Summary
 static boolean $compatibilityMode
 static string $_auto
 static string $_browser
 static string $_default
 static string $_environment
 string $_locale
Method Summary
 static void clearCache ()
 static void disableCache (boolean $flag)
 static string findLocale ([string $locale = null])
 static array getBrowser ()
 static array getCountryTranslation (string $value, [string|Zend_Locale $locale = null])
 static array getCountryTranslationList ([string|Zend_Locale $locale = null])
 static array getDefault ()
 static array getEnvironment ()
 static string getHttpCharset ()
 static array getLanguageTranslation (string $value, [string $locale = null])
 static array getLanguageTranslationList ([string|Zend_Locale $locale = null])
 static array getLocaleList ()
 static string|null getLocaleToTerritory (string $territory)
 static array getOrder ([ $order = null], string $searchorder)
 static array getQuestion ([string|Zend_Locale $locale = null])
 static array getScriptTranslation (string $value, [string $locale = null])
 static array getScriptTranslationList ([string|Zend_Locale $locale = null])
 static array getTerritoryTranslation (string $value, [string|Zend_Locale $locale = null])
 static array getTerritoryTranslationList ([string|Zend_Locale $locale = null])
 static string|false getTranslation ([string $value = null], [string $path = null], [string|Zend_Locale $locale = null])
 static array getTranslationList ([string $path = null], [string|Zend_Locale $locale = null], [string $value = null])
 static boolean hasCache ()
 static boolean isLocale (string|Zend_Locale $locale, [boolean $strict = false], [boolean $compatible = true])
 static void removeCache ()
 static void setCache ( $cache)
 static void setDefault (string|Zend_Locale $locale, [float $quality = 1])
 Zend_Locale __construct ([string|Zend_Locale $locale = null])
 boolean equals (Zend_Locale $object)
 string getLanguage ()
 string|false getRegion ()
 string serialize ()
 void setLocale ([string|Zend_Locale $locale = null])
 string toString ()
 string __toString ()
Variables
static boolean $compatibilityMode = false (line 191)

Defines if old behaviour should be supported Old behaviour throws notices and will be deleted in future releases

  • access: public
static string $_auto (line 212)

Automatic detected locale

  • var: Locales
  • access: protected
static string $_browser (line 219)

Browser detected locale

  • var: Locales
  • access: protected
static string $_default = array('en' => true) (line 233)

Default locale

  • var: Locales
  • access: protected
static string $_environment (line 226)

Environment detected locale

  • var: Locales
  • access: protected
string $_locale (line 205)

Actual set locale

  • var: Locale
  • access: protected
Methods
static clearCache (line 975)

Clears all set cache data

  • access: public
static void clearCache ()
static disableCache (line 987)

Disables the set cache

  • access: public
static void disableCache (boolean $flag)
  • boolean $flag: True disables any set cache, default is false
static findLocale (line 860)

Finds the proper locale based on the input

Checks if it exists, degrades it when necessary Detects registry locale and when all fails tries to detect a automatic locale Returns the found locale as string

  • throws: Zend_Locale_Exception When the given locale is no locale or the autodetection fails
  • access: public
static string findLocale ([string $locale = null])
  • string $locale
static getBrowser (line 423)

Return an array of all accepted languages of the client Expects RFC compilant Header !!

The notation can be : de,en-UK-US;q=0.5,fr-FR;q=0.2

  • return: - list of accepted languages including quality
  • access: public
static array getBrowser ()
static getCache (line 928)

Returns the set cache

  • return: The set cache
  • access: public
static Zend_Cache_Core getCache ()
static getCountryTranslation (line 709)

Returns the localized country name

  • deprecated:
  • access: public
static array getCountryTranslation (string $value, [string|Zend_Locale $locale = null])
  • string $value: Name to get detailed information about
  • string|Zend_Locale $locale: (Optional) Locale for country translation
static getCountryTranslationList (line 632)

Returns an array with the name of all countries translated to the given language

  • deprecated:
  • access: public
static array getCountryTranslationList ([string|Zend_Locale $locale = null])
  • string|Zend_Locale $locale: (Optional) Locale for country translation
static getDefault (line 290)

Return the default locale

  • return: Returns an array of all locale string
  • access: public
static array getDefault ()
static getEnvironment (line 364)

Expects the Systems standard locale

For Windows: f.e.: LC_COLLATE=C;LC_CTYPE=German_Austria.1252;LC_MONETARY=C would be recognised as de_AT

  • access: public
static array getEnvironment ()
static getHttpCharset (line 534)

Return the accepted charset of the client

  • access: public
static string getHttpCharset ()
static getLanguageTranslation (line 681)

Returns the localized language name

  • deprecated:
  • access: public
static array getLanguageTranslation (string $value, [string $locale = null])
  • string $value: Name to get detailed information about
  • string $locale: (Optional) Locale for language translation
static getLanguageTranslationList (line 606)

Returns an array with the name of all languages translated to the given language

  • deprecated:
  • access: public
static array getLanguageTranslationList ([string|Zend_Locale $locale = null])
  • string|Zend_Locale $locale: (Optional) Locale for language translation
static getLocaleList (line 913)

Returns a list of all known locales where the locale is the key Only real locales are returned, the internal locales 'root', 'auto', 'browser' and 'environment' are suppressed

  • return: List of all Locales
  • access: public
static array getLocaleList ()
static getLocaleToTerritory (line 896)

Returns the expected locale for a given territory

  • return: Locale string or null when no locale has been found
  • access: public
static string|null getLocaleToTerritory (string $territory)
  • string $territory: Territory for which the locale is being searched
static getOrder (line 1078)

Search the locale automatically and return all used locales ordered by quality

Standard Searchorder is Browser, Environment, Default

  • return: Returns an array of all detected locales
  • access: public
static array getOrder ([ $order = null], string $searchorder)
  • string $searchorder: (Optional) Searchorder
  • $order
static getQuestion (line 736)

Returns an array with translated yes strings

  • access: public
static array getQuestion ([string|Zend_Locale $locale = null])
  • string|Zend_Locale $locale: (Optional) Locale for language translation (defaults to $this locale)
static getScriptTranslation (line 695)

Returns the localized script name

  • deprecated:
  • access: public
static array getScriptTranslation (string $value, [string $locale = null])
  • string $value: Name to get detailed information about
  • string $locale: (Optional) locale for script translation
static getScriptTranslationList (line 619)

Returns an array with the name of all scripts translated to the given language

  • deprecated:
  • access: public
static array getScriptTranslationList ([string|Zend_Locale $locale = null])
  • string|Zend_Locale $locale: (Optional) Locale for script translation
static getTerritoryTranslation (line 724)

Returns the localized territory name All territories contains other countries.

  • deprecated:
  • access: public
static array getTerritoryTranslation (string $value, [string|Zend_Locale $locale = null])
  • string $value: Name to get detailed information about
  • string|Zend_Locale $locale: (Optional) Locale for territory translation
static getTerritoryTranslationList (line 646)

Returns an array with the name of all territories translated to the given language All territories contains other countries.

  • deprecated:
  • access: public
static array getTerritoryTranslationList ([string|Zend_Locale $locale = null])
  • string|Zend_Locale $locale: (Optional) Locale for territory translation
static getTranslation (line 661)

Returns a localized information string, supported are several types of informations.

For detailed information about the types look into the documentation

  • return: The wished information in the given language
  • access: public
static string|false getTranslation ([string $value = null], [string $path = null], [string|Zend_Locale $locale = null])
  • string $value: Name to get detailed information about
  • string $path: (Optional) Type of information to return
  • string|Zend_Locale $locale: (Optional) Locale|Language for which this informations should be returned
static getTranslationList (line 587)

Returns localized informations as array, supported are several types of informations.

For detailed information about the types look into the documentation

  • return: Array with the wished information in the given language
  • access: public
static array getTranslationList ([string $path = null], [string|Zend_Locale $locale = null], [string $value = null])
  • string $path: (Optional) Type of information to return
  • string|Zend_Locale $locale: (Optional) Locale|Language for which this informations should be returned
  • string $value: (Optional) Value for detail list
static hasCache (line 953)

Returns true when a cache is set

  • access: public
static boolean hasCache ()
static isLocale (line 808)

Checks if a locale identifier is a real locale or not

Examples: "en_XX" refers to "en", which returns true "XX_yy" refers to "root", which returns false

  • return: If the locale is known dependend on the settings
  • access: public
static boolean isLocale (string|Zend_Locale $locale, [boolean $strict = false], [boolean $compatible = true])
  • string|Zend_Locale $locale: Locale to check for
  • boolean $strict: (Optional) If true, no rerouting will be done when checking
  • boolean $compatible: (DEPRECATED) Only for internal usage, brakes compatibility mode
static removeCache (line 964)

Removes any set cache

  • access: public
static void removeCache ()
static setCache (line 942)

Sets a cache

  • access: public
static void setCache ( $cache)
static setDefault (line 322)

Sets a new default locale which will be used when no locale can be detected

If provided you can set a quality between 0 and 1 (or 2 and 100) which represents the percent of quality the browser requested within HTTP

  • throws: Zend_Locale_Exception When a autolocale was given
  • throws: Zend_Locale_Exception When a unknown locale was given
  • access: public
static void setDefault (string|Zend_Locale $locale, [float $quality = 1])
  • string|Zend_Locale $locale: Locale to set
  • float $quality: The quality to set from 0 to 1
Constructor __construct (line 248)

Generates a locale object

If no locale is given a automatic search is done Then the most probable locale will be automatically set Search order is

  1. Given Locale
  2. HTTP Client
  3. Server Environment
  4. Framework Standard

  • throws: Zend_Locale_Exception When autodetection has been failed
  • access: public
Zend_Locale __construct ([string|Zend_Locale $locale = null])
  • string|Zend_Locale $locale: (Optional) Locale for parsing input
equals (line 568)

Returns true if both locales are equal

  • access: public
boolean equals (Zend_Locale $object)
getLanguage (line 508)

Returns the language part of the locale

  • access: public
string getLanguage ()
getRegion (line 519)

Returns the region part of the locale if available

  • return: - Regionstring
  • access: public
string|false getRegion ()
serialize (line 259)

Serialization Interface

  • access: public
string serialize ()
setLocale (line 481)

Sets a new locale

  • access: public
void setLocale ([string|Zend_Locale $locale = null])
  • string|Zend_Locale $locale: (Optional) New locale to set
toString (line 269)

Returns a string representation of the object

  • access: public
string toString ()
__toString (line 280)

Returns a string representation of the object Alias for toString

  • access: public
string __toString ()
Class Constants
BROWSER = 'browser' (line 181)

Autosearch constants

ENVIRONMENT = 'environment' (line 182)
ZFDEFAULT = 'default' (line 183)

Documentation generated on Mon, 21 Jun 2010 15:31:39 -0400 by phpDocumentor 1.4.3