Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes | Static Protected Attributes

Zend_Translate_Adapter Class Reference

Inheritance diagram for Zend_Translate_Adapter:
Zend_Translate_Adapter_Array Zend_Translate_Adapter_Csv Zend_Translate_Adapter_Gettext Zend_Translate_Adapter_Ini Zend_Translate_Adapter_Qt Zend_Translate_Adapter_Tbx Zend_Translate_Adapter_Tmx Zend_Translate_Adapter_Xliff Zend_Translate_Adapter_XmlTm

Public Member Functions

 __construct ($data, $locale=null, array $options=array())
 addTranslation ($data, $locale=null, array $options=array())
 setOptions (array $options=array())
 getOptions ($optionKey=null)
 getLocale ()
 setLocale ($locale)
 getList ()
 getMessageIds ($locale=null)
 getMessages ($locale=null)
 isAvailable ($locale)
 translate ($messageId, $locale=null)
 plural ($singular, $plural, $number, $locale=null)
 _ ($messageId, $locale=null)
 isTranslated ($messageId, $original=false, $locale=null)
 toString ()

Static Public Member Functions

static getCache ()
static setCache (Zend_Cache_Core $cache)
static hasCache ()
static removeCache ()
static clearCache ()

Data Fields

const LOCALE_DIRECTORY = 'directory'
const LOCALE_FILENAME = 'filename'

Protected Member Functions

 _loadTranslationData ($data, $locale, array $options=array())
 _log ($message, $locale)

Protected Attributes

 $_options
 $_translate = array()

Static Protected Attributes

static $_cache = null

Detailed Description

Definition at line 42 of file Adapter.php.


Constructor & Destructor Documentation

__construct ( data,
locale = null,
array $  options = array() 
)

Generates the adapter

Parameters:
string | array$dataTranslation data or filename for this adapter
string | Zend_Locale$locale(optional) Locale/Language to set, identical with Locale identifiers see Zend_Locale for more information
array$options(optional) Options for the adaptor
Exceptions:
Zend_Translate_Exception
Returns:
void

Reimplemented in Zend_Translate_Adapter_Array, Zend_Translate_Adapter_Csv, Zend_Translate_Adapter_Gettext, Zend_Translate_Adapter_Ini, Zend_Translate_Adapter_Qt, Zend_Translate_Adapter_Tbx, Zend_Translate_Adapter_Tmx, Zend_Translate_Adapter_Xliff, and Zend_Translate_Adapter_XmlTm.

Definition at line 101 of file Adapter.php.


Member Function Documentation

_ ( messageId,
locale = null 
)

Translates the given string returns the translation

Parameters:
string$messageIdTranslation string
string | Zend_Locale$locale(optional) Locale/Language to use, identical with locale identifier,
See also:
Zend_Locale for more information
Returns:
string

Definition at line 643 of file Adapter.php.

_loadTranslationData ( data,
locale,
array $  options = array() 
) [abstract, protected]
_log ( message,
locale 
) [protected]

Logs a message when the log option is set

Parameters:
string$messageMessage to log
String$localeLocale to log

Definition at line 622 of file Adapter.php.

addTranslation ( data,
locale = null,
array $  options = array() 
)

Add translation data

It may be a new language or additional data for existing language If $clear parameter is true, then translation data for specified language is replaced and added otherwise

Parameters:
array | string$dataTranslation data
string | Zend_Locale$locale(optional) Locale/Language to add data for, identical with locale identifier, see Zend_Locale for more information
array$options(optional) Option for this Adapter
Exceptions:
Zend_Translate_Exception
Returns:
Zend_Translate_Adapter Provides fluent interface

Definition at line 137 of file Adapter.php.

static clearCache (  ) [static]

Clears all set cache data

Returns:
void

Definition at line 749 of file Adapter.php.

static getCache (  ) [static]

Returns the set cache

Returns:
Zend_Cache_Core The set cache

Definition at line 705 of file Adapter.php.

getList (  )

Returns the available languages from this adapter

Returns:
array

Definition at line 357 of file Adapter.php.

getLocale (  )

Gets locale

Returns:
Zend_Locale|string|null

Definition at line 288 of file Adapter.php.

getMessageIds ( locale = null )

Returns all available message ids from this adapter If no locale is given, the actual language will be used

Parameters:
string | Zend_Locale$locale(optional) Language to return the message ids from
Returns:
array

Definition at line 376 of file Adapter.php.

getMessages ( locale = null )

Returns all available translations from this adapter If no locale is given, the actual language will be used If 'all' is given the complete translation dictionary will be returned

Parameters:
string | Zend_Locale$locale(optional) Language to return the messages from
Returns:
array

Definition at line 393 of file Adapter.php.

getOptions ( optionKey = null )

Returns the adapters name and it's options

Parameters:
string | null$optionKeyString returns this option null returns all options
Returns:
integer|string|array|null

Definition at line 270 of file Adapter.php.

static hasCache (  ) [static]

Returns true when a cache is set

Returns:
boolean

Definition at line 725 of file Adapter.php.

isAvailable ( locale )

Is the wished language available ?

See also:
Zend_Locale
Parameters:
string | Zend_Locale$localeLanguage to search for, identical with locale identifier,
See also:
Zend_Locale for more information
Returns:
boolean

Definition at line 414 of file Adapter.php.

isTranslated ( messageId,
original = false,
locale = null 
)

Checks if a string is translated within the source or not returns boolean

Parameters:
string$messageIdTranslation string
boolean$original(optional) Allow translation only for original language when true, a translation for 'en_US' would give false when it can be translated with 'en' only
string | Zend_Locale$locale(optional) Locale/Language to use, identical with locale identifier, see Zend_Locale for more information
Returns:
boolean

Definition at line 660 of file Adapter.php.

plural ( singular,
plural,
number,
locale = null 
)

Translates the given string using plural notations Returns the translated string

See also:
Zend_Locale
Parameters:
string$singularSingular translation string
string$pluralPlural translation string
integer$numberNumber for detecting the correct plural
string | Zend_Locale$locale(Optional) Locale/Language to use, identical with locale identifier,
See also:
Zend_Locale for more information
Returns:
string

Definition at line 611 of file Adapter.php.

static removeCache (  ) [static]

Removes any set cache

Returns:
void

Definition at line 739 of file Adapter.php.

static setCache ( Zend_Cache_Core cache ) [static]

Sets a cache for all Zend_Translate_Adapters

Parameters:
Zend_Cache_Core$cacheCache to store to

Definition at line 715 of file Adapter.php.

setLocale ( locale )

Sets locale

Parameters:
string | Zend_Locale$localeLocale to set
Exceptions:
Zend_Translate_Exception
Returns:
Zend_Translate_Adapter Provides fluent interface

Definition at line 300 of file Adapter.php.

setOptions ( array $  options = array() )

Sets new adapter options

Parameters:
array$optionsAdapter options
Exceptions:
Zend_Translate_Exception
Returns:
Zend_Translate_Adapter Provides fluent interface

Definition at line 232 of file Adapter.php.

toString (  ) [abstract]
translate ( messageId,
locale = null 
)

Translates the given string returns the translation

See also:
Zend_Locale
Parameters:
string | array$messageIdTranslation string, or Array for plural translations
string | Zend_Locale$locale(optional) Locale/Language to use, identical with locale identifier,
See also:
Zend_Locale for more information
Returns:
string

Definition at line 515 of file Adapter.php.


Field Documentation

$_options [protected]
Initial value:
 array(
        'clear'           => false,
        'disableNotices'  => false,
        'ignore'          => '.',
        'locale'          => 'auto',
        'log'             => null,
        'logMessage'      => "Untranslated message within '%locale%': %message%",
        'logUntranslated' => false,
        'scan'            => null
    )

Definition at line 74 of file Adapter.php.

const LOCALE_DIRECTORY = 'directory'

Scans for the locale within the name of the directory integer

Definition at line 59 of file Adapter.php.

const LOCALE_FILENAME = 'filename'

Scans for the locale within the name of the file integer

Definition at line 65 of file Adapter.php.


The documentation for this class was generated from the following file: