API Documentation

Locale.php

Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Locale
version
$Id: Locale.php 22536 2010-07-07 21:41:48Z thomas $
Classes
Zend_Locale

Description

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Zend_Locale

category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Locale
Constants
BROWSER
ENVIRONMENT
ZFDEFAULT
Properties
$_localeData
$_territoryData
$compatibilityMode
$_breakChain
$_locale
$_auto
$_browser
$_environment
$_default
Methods
__construct
serialize
toString
__toString
getDefault
setDefault
getEnvironment
getBrowser
setLocale
getLanguage
getRegion
getHttpCharset
equals
getTranslationList
getLanguageTranslationList
getScriptTranslationList
getCountryTranslationList
getTerritoryTranslationList
getTranslation
getLanguageTranslation
getScriptTranslation
getCountryTranslation
getTerritoryTranslation
getQuestion
_prepareQuestionString
isLocale
findLocale
getLocaleToTerritory
getLocaleList
getCache
setCache
hasCache
removeCache
clearCache
disableCache
_prepareLocale
getOrder

Description

Base class for localization

Constants

BROWSER

 BROWSER = 'browser'

Autosearch constants

Details

value
browser

ENVIRONMENT

 ENVIRONMENT = 'environment'

Details

value
environment

ZFDEFAULT

 ZFDEFAULT = 'default'

Details

value
default

Properties

$_auto

string $_auto = ''

Automatic detected locale

Details

$_auto
string
Locales
visibility
protected
default
final
false
static
true

$_breakChain

boolean $_breakChain = 'false'

Internal variable

Details

$_breakChain
boolean
visibility
private
default
false
final
false
static
true

$_browser

string $_browser = ''

Browser detected locale

Details

$_browser
string
Locales
visibility
protected
default
final
false
static
true

$_default

string $_default = 'array'

Default locale

Details

$_default
string
Locales
visibility
protected
default
array
final
false
static
true

$_environment

string $_environment = ''

Environment detected locale

Details

$_environment
string
Locales
visibility
protected
default
final
false
static
true

$_locale

string $_locale = ''

Actual set locale

Details

$_locale
string
Locale
visibility
protected
default
final
false
static
false

$_localeData

array $_localeData = 'array'

Class wide Locale Constants

Details

$_localeData
array
visibility
private
default
array
final
false
static
true

$_territoryData

array $_territoryData = 'array'

Class wide Locale Constants

Details

$_territoryData
array
visibility
private
default
array
final
false
static
true

$compatibilityMode

boolean $compatibilityMode = 'false'

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

Details

$compatibilityMode
boolean
visibility
public
default
false
final
false
static
true

Methods

__construct

__construct( string|Zend_Locale $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

Arguments
$locale
stringZend_Locale
(Optional) Locale for parsing input
Details
visibility
public
final
false
static
false
throws
When autodetection has been failed

__toString

__toString( ) : string

Returns a string representation of the object Alias for toString

Output
string
Details
visibility
public
final
false
static
false

_prepareLocale

_prepareLocale( string|Zend_Locale $locale, boolean $strict = false ) : string

Internal function, returns a single locale on detection

Arguments
$locale
stringZend_Locale
(Optional) Locale to work on
$strict
boolean
(Optional) Strict preparation
Output
string
Details
visibility
private
final
false
static
true
throws
When no locale is set which is only possible when the class was wrong extended

_prepareQuestionString

_prepareQuestionString( string $input ) : string

Internal function for preparing the returned question regex string

Arguments
$input
string
Regex to parse
Output
string
Details
visibility
private
final
false
static
true

clearCache

clearCache( ) : void

Clears all set cache data

Details
visibility
public
final
false
static
true

disableCache

disableCache( boolean $flag ) : void

Disables the set cache

Arguments
$flag
boolean
True disables any set cache, default is false
Details
visibility
public
final
false
static
true

equals

equals( Zend_Locale $object ) : boolean

Returns true if both locales are equal

Arguments
$object
Zend_Locale
Locale to check for equality
Output
boolean
Details
visibility
public
final
false
static
false

findLocale

findLocale( string $locale = null ) : string

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

Arguments
$locale
string
Output
string
Details
visibility
public
final
false
static
true
throws
When the given locale is no locale or the autodetection fails

getBrowser

getBrowser( ) : array

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

Output
array
- list of accepted languages including quality
Details
visibility
public
final
false
static
true

getCache

getCache( ) : Zend_Cache_Core

Returns the set cache

Output
Zend_Cache_Core
The set cache
Details
visibility
public
final
false
static
true

getCountryTranslation

getCountryTranslation( string $value, string|Zend_Locale $locale = null ) : array

Returns the localized country name

Arguments
$value
string
Name to get detailed information about
$locale
stringZend_Locale
(Optional) Locale for country translation
Output
array
Details
visibility
public
final
false
static
true
deprecated

getCountryTranslationList

getCountryTranslationList( string|Zend_Locale $locale = null ) : array

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

Arguments
$locale
stringZend_Locale
(Optional) Locale for country translation
Output
array
Details
visibility
public
final
false
static
true
deprecated

getDefault

getDefault( ) : array

Return the default locale

Output
array
Returns an array of all locale string
Details
visibility
public
final
false
static
true

getEnvironment

getEnvironment( ) : array

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

Output
array
Details
visibility
public
final
false
static
true

getHttpCharset

getHttpCharset( ) : string

Return the accepted charset of the client

Output
string
Details
visibility
public
final
false
static
true

getLanguage

getLanguage( ) : string

Returns the language part of the locale

Output
string
Details
visibility
public
final
false
static
false

getLanguageTranslation

getLanguageTranslation( string $value, string $locale = null ) : array

Returns the localized language name

Arguments
$value
string
Name to get detailed information about
$locale
string
(Optional) Locale for language translation
Output
array
Details
visibility
public
final
false
static
true
deprecated

getLanguageTranslationList

getLanguageTranslationList( string|Zend_Locale $locale = null ) : array

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

Arguments
$locale
stringZend_Locale
(Optional) Locale for language translation
Output
array
Details
visibility
public
final
false
static
true
deprecated

getLocaleList

getLocaleList( ) : array

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

Output
array
List of all Locales
Details
visibility
public
final
false
static
true

getLocaleToTerritory

getLocaleToTerritory( string $territory ) : string|null

Returns the expected locale for a given territory

Arguments
$territory
string
Territory for which the locale is being searched
Output
string|null
Locale string or null when no locale has been found
Details
visibility
public
final
false
static
true

getOrder

getOrder(  $order = null ) : array

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

Standard Searchorder is Browser, Environment, Default

Arguments
$order
Output
array
Returns an array of all detected locales
Details
visibility
public
final
false
static
true

getQuestion

getQuestion( string|Zend_Locale $locale = null ) : array

Returns an array with translated yes strings

Arguments
$locale
stringZend_Locale
(Optional) Locale for language translation (defaults to $this locale)
Output
array
Details
visibility
public
final
false
static
true

getRegion

getRegion( ) : string|false

Returns the region part of the locale if available

Output
string|false
- Regionstring
Details
visibility
public
final
false
static
false

getScriptTranslation

getScriptTranslation( string $value, string $locale = null ) : array

Returns the localized script name

Arguments
$value
string
Name to get detailed information about
$locale
string
(Optional) locale for script translation
Output
array
Details
visibility
public
final
false
static
true
deprecated

getScriptTranslationList

getScriptTranslationList( string|Zend_Locale $locale = null ) : array

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

Arguments
$locale
stringZend_Locale
(Optional) Locale for script translation
Output
array
Details
visibility
public
final
false
static
true
deprecated

getTerritoryTranslation

getTerritoryTranslation( string $value, string|Zend_Locale $locale = null ) : array

Returns the localized territory name All territories contains other countries.

Arguments
$value
string
Name to get detailed information about
$locale
stringZend_Locale
(Optional) Locale for territory translation
Output
array
Details
visibility
public
final
false
static
true
deprecated

getTerritoryTranslationList

getTerritoryTranslationList( string|Zend_Locale $locale = null ) : array

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

Arguments
$locale
stringZend_Locale
(Optional) Locale for territory translation
Output
array
Details
visibility
public
final
false
static
true
deprecated

getTranslation

getTranslation( string $value = null, string $path = null, string|Zend_Locale $locale = null ) : string|false

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

For detailed information about the types look into the documentation

Arguments
$value
string
Name to get detailed information about
$path
string
(Optional) Type of information to return
$locale
stringZend_Locale
(Optional) Locale|Language for which this informations should be returned
Output
string|false
The wished information in the given language
Details
visibility
public
final
false
static
true

getTranslationList

getTranslationList( string $path = null, string|Zend_Locale $locale = null, string $value = null ) : array

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

For detailed information about the types look into the documentation

Arguments
$path
string
(Optional) Type of information to return
$locale
stringZend_Locale
(Optional) Locale|Language for which this informations should be returned
$value
string
(Optional) Value for detail list
Output
array
Array with the wished information in the given language
Details
visibility
public
final
false
static
true

hasCache

hasCache( ) : boolean

Returns true when a cache is set

Output
boolean
Details
visibility
public
final
false
static
true

isLocale

isLocale( string|Zend_Locale $locale, boolean $strict = false, boolean $compatible = true ) : boolean

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

Arguments
$locale
stringZend_Locale
Locale to check for
$strict
boolean
(Optional) If true, no rerouting will be done when checking
$compatible
boolean
(DEPRECATED) Only for internal usage, brakes compatibility mode
Output
boolean
If the locale is known dependend on the settings
Details
visibility
public
final
false
static
true

removeCache

removeCache( ) : void

Removes any set cache

Details
visibility
public
final
false
static
true

serialize

serialize( ) : string

Serialization Interface

Output
string
Details
visibility
public
final
false
static
false

setCache

setCache( Zend_Cache_Core $cache ) : void

Sets a cache

Arguments
$cache
Zend_Cache_Core
Cache to set
Details
visibility
public
final
false
static
true

setDefault

setDefault( string|Zend_Locale $locale, float $quality = 1 ) : void

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

Arguments
$locale
stringZend_Locale
Locale to set
$quality
float
The quality to set from 0 to 1
Details
visibility
public
final
false
static
true
throws
When a autolocale was given
throws
When a unknown locale was given

setLocale

setLocale( string|Zend_Locale $locale = null ) : void

Sets a new locale

Arguments
$locale
stringZend_Locale
(Optional) New locale to set
Details
visibility
public
final
false
static
false

toString

toString( ) : string

Returns a string representation of the object

Output
string
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.