API Documentation

Zend/Locale.php

Show: inherited
Table of Contents

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.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Locale  
Version
$Id: Locale.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Locale

Package: Zend\Locale

Base class for localization

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

Constant  BROWSER = 'browser'

Autosearch constants

Constant  ENVIRONMENT = 'environment'
Constant  ZFDEFAULT = 'default'

Properties

Propertyprotectedstring  $_auto= ''
static

Automatic detected locale

Locales
Details
Type
string
Propertyprivateboolean  $_breakChain= 'false'
static

Internal variable

Default valuefalseDetails
Type
boolean
Propertyprotectedstring  $_browser= ''
static

Browser detected locale

Locales
Details
Type
string
Propertyprotectedstring  $_default= 'array('en' => true)'
static

Default locale

Locales
Default valuearray('en' => true)Details
Type
string
Propertyprotectedstring  $_environment= ''
static

Environment detected locale

Locales
Details
Type
string
Propertyprotectedstring  $_locale= ''

Actual set locale

Locale
Details
Type
string
Propertyprivatearray  $_localeData= 'array( 'root' => true'
static

Class wide Locale Constants

Default valuearray( 'root' => trueDetails
Type
array
Propertyprivatearray  $_territoryData= 'array( 'AD' => 'ca_AD''
static

Class wide Locale Constants

Default valuearray( 'AD' => 'ca_AD'Details
Type
array
Propertypublicboolean  $compatibilityMode= 'false'
static

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

Default valuefalseDetails
Type
boolean

Methods

methodpublic__construct( string|\Zend_Locale $locale = null ) : void

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
Name Type Description
$locale string|\Zend_Locale

(Optional) Locale for parsing input

Throws
Exception Description
\Zend_Locale_Exception When autodetection has been failed
methodpublic__toString( ) : string

Returns a string representation of the object Alias for toString

Returns
Type Description
string
methodprivate_prepareLocale( string|\Zend_Locale $locale, boolean $strict = false ) : string
static

Internal function, returns a single locale on detection

Parameters
Name Type Description
$locale string|\Zend_Locale

(Optional) Locale to work on

$strict boolean

(Optional) Strict preparation

Returns
Type Description
string
Throws
Exception Description
\Zend_Locale_Exception When no locale is set which is only possible when the class was wrong extended
methodprivate_prepareQuestionString( string $input ) : string
static

Internal function for preparing the returned question regex string

Parameters
Name Type Description
$input string

Regex to parse

Returns
Type Description
string
methodpublicclearCache( string $tag = null ) : void
static

Clears all set cache data

Parameters
Name Type Description
$tag string

Tag to clear when the default tag name is not used

methodpublicdisableCache( boolean $flag ) : void
static

Disables the set cache

Parameters
Name Type Description
$flag boolean

True disables any set cache, default is false

methodpublicequals( \Zend_Locale $object ) : boolean

Returns true if both locales are equal

Parameters
Name Type Description
$object \Zend_Locale

Locale to check for equality

Returns
Type Description
boolean
methodpublicfindLocale( string $locale = null ) : string
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
Name Type Description
$locale string
Returns
Type Description
string
Throws
Exception Description
\Zend_Locale_Exception When the given locale is no locale or the autodetection fails
methodpublicgetBrowser( ) : array
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
Type Description
array - list of accepted languages including quality
methodpublicgetCache( ) : \Zend_Cache_Core
static

Returns the set cache

Returns
Type Description
\Zend_Cache_Core The set cache
methodpublicgetCountryTranslation( string $value, string|\Zend_Locale $locale = null ) : array
static

Returns the localized country name

Parameters
Name Type Description
$value string

Name to get detailed information about

$locale string|\Zend_Locale

(Optional) Locale for country translation

Returns
Type Description
array
Details
Deprecated
 
methodpublicgetCountryTranslationList( string|\Zend_Locale $locale = null ) : array
static

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

Parameters
Name Type Description
$locale string|\Zend_Locale

(Optional) Locale for country translation

Returns
Type Description
array
Details
Deprecated
 
methodpublicgetDefault( ) : array
static

Return the default locale

Returns
Type Description
array Returns an array of all locale string
methodpublicgetEnvironment( ) : array
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
Type Description
array
methodpublicgetHttpCharset( ) : string
static

Return the accepted charset of the client

Returns
Type Description
string
methodpublicgetLanguage( ) : string

Returns the language part of the locale

Returns
Type Description
string
methodpublicgetLanguageTranslation( string $value, string $locale = null ) : array
static

Returns the localized language name

Parameters
Name Type Description
$value string

Name to get detailed information about

$locale string

(Optional) Locale for language translation

Returns
Type Description
array
Details
Deprecated
 
methodpublicgetLanguageTranslationList( string|\Zend_Locale $locale = null ) : array
static

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

Parameters
Name Type Description
$locale string|\Zend_Locale

(Optional) Locale for language translation

Returns
Type Description
array
Details
Deprecated
 
methodpublicgetLocaleList( ) : array
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
Type Description
array List of all Locales
methodpublicgetLocaleToTerritory( string $territory ) : string|null
static

Returns the expected locale for a given territory

Parameters
Name Type Description
$territory string

Territory for which the locale is being searched

Returns
Type Description
string|null Locale string or null when no locale has been found
methodpublicgetOrder(  $order = null ) : array
static

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

Standard Searchorder is Browser, Environment, Default

Parameters
Name Type Description
$order
Returns
Type Description
array Returns an array of all detected locales
methodpublicgetQuestion( string|\Zend_Locale $locale = null ) : array
static

Returns an array with translated yes strings

Parameters
Name Type Description
$locale string|\Zend_Locale

(Optional) Locale for language translation (defaults to $this locale)

Returns
Type Description
array
methodpublicgetRegion( ) : string|false

Returns the region part of the locale if available

Returns
Type Description
string|false - Regionstring
methodpublicgetScriptTranslation( string $value, string $locale = null ) : array
static

Returns the localized script name

Parameters
Name Type Description
$value string

Name to get detailed information about

$locale string

(Optional) locale for script translation

Returns
Type Description
array
Details
Deprecated
 
methodpublicgetScriptTranslationList( string|\Zend_Locale $locale = null ) : array
static

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

Parameters
Name Type Description
$locale string|\Zend_Locale

(Optional) Locale for script translation

Returns
Type Description
array
Details
Deprecated
 
methodpublicgetTerritoryTranslation( string $value, string|\Zend_Locale $locale = null ) : array
static

Returns the localized territory name All territories contains other countries.

Parameters
Name Type Description
$value string

Name to get detailed information about

$locale string|\Zend_Locale

(Optional) Locale for territory translation

Returns
Type Description
array
Details
Deprecated
 
methodpublicgetTerritoryTranslationList( string|\Zend_Locale $locale = null ) : array
static

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

Parameters
Name Type Description
$locale string|\Zend_Locale

(Optional) Locale for territory translation

Returns
Type Description
array
Details
Deprecated
 
methodpublicgetTranslation( string $value = null, string $path = null, string|\Zend_Locale $locale = null ) : string|false
static

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

For detailed information about the types look into the documentation

Parameters
Name Type Description
$value string

Name to get detailed information about

$path string

(Optional) Type of information to return

$locale string|\Zend_Locale

(Optional) Locale|Language for which this informations should be returned

Returns
Type Description
string|false The wished information in the given language
methodpublicgetTranslationList( string $path = null, string|\Zend_Locale $locale = null, string $value = null ) : array
static

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

For detailed information about the types look into the documentation

Parameters
Name Type Description
$path string

(Optional) Type of information to return

$locale string|\Zend_Locale

(Optional) Locale|Language for which this informations should be returned

$value string

(Optional) Value for detail list

Returns
Type Description
array Array with the wished information in the given language
methodpublichasCache( ) : boolean
static

Returns true when a cache is set

Returns
Type Description
boolean
methodpublicisLocale( string|\Zend_Locale $locale, boolean $strict = false, boolean $compatible = true ) : boolean
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
Name Type Description
$locale string|\Zend_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

Returns
Type Description
boolean If the locale is known dependend on the settings
methodpublicremoveCache( ) : void
static

Removes any set cache

methodpublicserialize( ) : string

Serialization Interface

Returns
Type Description
string
methodpublicsetCache( \Zend_Cache_Core $cache ) : void
static

Sets a cache

Parameters
Name Type Description
$cache \Zend_Cache_Core

Cache to set

methodpublicsetDefault( string|\Zend_Locale $locale, float $quality = 1 ) : void
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
Name Type Description
$locale string|\Zend_Locale

Locale to set

$quality float

The quality to set from 0 to 1

Throws
Exception Description
\Zend_Locale_Exception When a autolocale was given
\Zend_Locale_Exception When a unknown locale was given
methodpublicsetLocale( string|\Zend_Locale $locale = null ) : void

Sets a new locale

Parameters
Name Type Description
$locale string|\Zend_Locale

(Optional) New locale to set

methodpublictoString( ) : string

Returns a string representation of the object

Returns
Type Description
string
Documentation was generated by DocBlox 0.15.1.