Zend Framework  1.12
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | Static Protected Attributes | List of all members
Zend_Locale Class Reference

Public Member Functions

 __construct ($locale=null)
 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.
 
 serialize ()
 Serialization Interface.
 
 toString ()
 Returns a string representation of the object.
 
 __toString ()
 Returns a string representation of the object Alias for toString.
 
 setLocale ($locale=null)
 Sets a new locale.
 
 getLanguage ()
 Returns the language part of the locale.
 
 getRegion ()
 Returns the region part of the locale if available.
 
 equals (Zend_Locale $object)
 Returns true if both locales are equal.
 

Static Public Member Functions

static getDefault ()
 Return the default locale.
 
static setDefault ($locale, $quality=1)
 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.
 
static getEnvironment ()
 Expects the Systems standard locale.
 
static getBrowser ()
 Return an array of all accepted languages of the client Expects RFC compilant Header !!
 
static getHttpCharset ()
 Return the accepted charset of the client.
 
static getTranslationList ($path=null, $locale=null, $value=null)
 Returns localized informations as array, supported are several types of informations.
 
static getLanguageTranslationList ($locale=null)
 Returns an array with the name of all languages translated to the given language.
 
static getScriptTranslationList ($locale=null)
 Returns an array with the name of all scripts translated to the given language.
 
static getCountryTranslationList ($locale=null)
 Returns an array with the name of all countries translated to the given language.
 
static getTerritoryTranslationList ($locale=null)
 Returns an array with the name of all territories translated to the given language All territories contains other countries.
 
static getTranslation ($value=null, $path=null, $locale=null)
 Returns a localized information string, supported are several types of informations.
 
static getLanguageTranslation ($value, $locale=null)
 Returns the localized language name.
 
static getScriptTranslation ($value, $locale=null)
 Returns the localized script name.
 
static getCountryTranslation ($value, $locale=null)
 Returns the localized country name.
 
static getTerritoryTranslation ($value, $locale=null)
 Returns the localized territory name All territories contains other countries.
 
static getQuestion ($locale=null)
 Returns an array with translated yes strings.
 
static isLocale ($locale, $strict=false, $compatible=true)
 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.
 
static findLocale ($locale=null)
 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.
 
static getLocaleToTerritory ($territory)
 Returns the expected locale for a given territory.
 
static getLocaleList ()
 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.
 
static getCache ()
 Returns the set cache.
 
static setCache (Zend_Cache_Core $cache)
 Sets a cache.
 
static hasCache ()
 Returns true when a cache is set.
 
static removeCache ()
 Removes any set cache.
 
static clearCache ($tag=null)
 Clears all set cache data.
 
static disableCache ($flag)
 Disables the set cache.
 
static getOrder ($order=null)
 Search the locale automatically and return all used locales ordered by quality.
 

Public Attributes

const BROWSER = 'browser'
 Autosearch constants.
 
const ENVIRONMENT = 'environment'
 
const ZFDEFAULT = 'default'
 

Static Public Attributes

static $compatibilityMode = false
 

Protected Attributes

 $_locale
 

Static Protected Attributes

static $_auto
 
static $_browser
 
static $_environment
 
static $_default = array('en' => true)
 

Constructor & Destructor Documentation

__construct (   $locale = null)

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

Parameters
string | Zend_Locale$locale(Optional) Locale for parsing input
Exceptions
Zend_Locale_ExceptionWhen autodetection has been failed

Member Function Documentation

__toString ( )

Returns a string representation of the object Alias for toString.

Returns
string
static clearCache (   $tag = null)
static

Clears all set cache data.

Parameters
string$tagTag to clear when the default tag name is not used
Returns
void
static disableCache (   $flag)
static

Disables the set cache.

Parameters
boolean$flagTrue disables any set cache, default is false
Returns
void
equals ( Zend_Locale  $object)

Returns true if both locales are equal.

Parameters
Zend_Locale$objectLocale to check for equality
Returns
boolean
static findLocale (   $locale = null)
static

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.

Parameters
string$locale
Exceptions
Zend_Locale_ExceptionWhen the given locale is no locale or the autodetection fails
Returns
string
static getBrowser ( )
static

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

Returns
array - list of accepted languages including quality
static getCache ( )
static

Returns the set cache.

Returns
Zend_Cache_Core The set cache
static getCountryTranslation (   $value,
  $locale = null 
)
static

Returns the localized country name.

Parameters
string$valueName to get detailed information about
string | Zend_Locale$locale(Optional) Locale for country translation
Returns
array
Deprecated:
static getCountryTranslationList (   $locale = null)
static

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

Parameters
string | Zend_Locale$locale(Optional) Locale for country translation
Returns
array
Deprecated:
static getDefault ( )
static

Return the default locale.

Returns
array Returns an array of all locale string
static getEnvironment ( )
static

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

Returns
array
static getHttpCharset ( )
static

Return the accepted charset of the client.

Returns
string
getLanguage ( )

Returns the language part of the locale.

Returns
string
static getLanguageTranslation (   $value,
  $locale = null 
)
static

Returns the localized language name.

Parameters
string$valueName to get detailed information about
string$locale(Optional) Locale for language translation
Returns
array
Deprecated:
static getLanguageTranslationList (   $locale = null)
static

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

Parameters
string | Zend_Locale$locale(Optional) Locale for language translation
Returns
array
Deprecated:
static getLocaleList ( )
static

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.

Returns
array List of all Locales
static getLocaleToTerritory (   $territory)
static

Returns the expected locale for a given territory.

Parameters
string$territoryTerritory for which the locale is being searched
Returns
string|null Locale string or null when no locale has been found
static getOrder (   $order = null)
static

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

Standard Searchorder is Browser, Environment, Default

Parameters
string$searchorder(Optional) Searchorder
Returns
array Returns an array of all detected locales
static getQuestion (   $locale = null)
static

Returns an array with translated yes strings.

Parameters
string | Zend_Locale$locale(Optional) Locale for language translation (defaults to $this locale)
Returns
array
getRegion ( )

Returns the region part of the locale if available.

Returns
string|false - Regionstring
static getScriptTranslation (   $value,
  $locale = null 
)
static

Returns the localized script name.

Parameters
string$valueName to get detailed information about
string$locale(Optional) locale for script translation
Returns
array
Deprecated:
static getScriptTranslationList (   $locale = null)
static

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

Parameters
string | Zend_Locale$locale(Optional) Locale for script translation
Returns
array
Deprecated:
static getTerritoryTranslation (   $value,
  $locale = null 
)
static

Returns the localized territory name All territories contains other countries.

Parameters
string$valueName to get detailed information about
string | Zend_Locale$locale(Optional) Locale for territory translation
Returns
array
Deprecated:
static getTerritoryTranslationList (   $locale = null)
static

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

Parameters
string | Zend_Locale$locale(Optional) Locale for territory translation
Returns
array
Deprecated:
static getTranslation (   $value = null,
  $path = null,
  $locale = null 
)
static

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

For detailed information about the types look into the documentation

Parameters
string$valueName 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
Returns
string|false The wished information in the given language
static getTranslationList (   $path = null,
  $locale = null,
  $value = null 
)
static

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

For detailed information about the types look into the documentation

Parameters
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
Returns
array Array with the wished information in the given language
static hasCache ( )
static

Returns true when a cache is set.

Returns
boolean
static isLocale (   $locale,
  $strict = false,
  $compatible = true 
)
static

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.

Parameters
string | Zend_Locale$localeLocale 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
Returns
boolean If the locale is known dependend on the settings
static removeCache ( )
static

Removes any set cache.

Returns
void
serialize ( )

Serialization Interface.

Returns
string
static setCache ( Zend_Cache_Core  $cache)
static

Sets a cache.

Parameters
Zend_Cache_Core$cacheCache to set
Returns
void
static setDefault (   $locale,
  $quality = 1 
)
static

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.

Parameters
string | Zend_Locale$localeLocale to set
float$qualityThe quality to set from 0 to 1
Exceptions
Zend_Locale_ExceptionWhen a autolocale was given
Zend_Locale_ExceptionWhen a unknown locale was given
Returns
void
setLocale (   $locale = null)

Sets a new locale.

Parameters
string | Zend_Locale$locale(Optional) New locale to set
Returns
void
toString ( )

Returns a string representation of the object.

Returns
string

Member Data Documentation

$_auto
staticprotected
$_browser
staticprotected
$_default = array('en' => true)
staticprotected
$_environment
staticprotected
$_locale
protected
$compatibilityMode = false
static
const BROWSER = 'browser'

Autosearch constants.

const ENVIRONMENT = 'environment'
const ZFDEFAULT = 'default'