Basic adapter class for each translation source adapter

category Zend
package Zend_Translate
copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
subpackage Zend_Translate_Adapter

 Methods

Translates the given string returns the translation

_(string $messageId, string | \Zend_Locale $locale) : string
Inherited

inherited_from \Zend_Translate_Adapter::_()

Parameters

$messageId

string

Translation string

$locale

string\Zend_Locale

(optional) Locale/Language to use, identical with locale identifier, @see Zend_Locale for more information

Returns

string

Generates the adapter

__construct(array | \Zend_Config $options) : void
Inherited

inherited_from \Zend_Translate_Adapter::__construct()

Parameters

$options

array\Zend_Config

Translation options for this adapter

Exceptions

\Zend_Translate_Exception

Add translations

addTranslation(array | \Zend_Config $options) : \Zend_Translate_Adapter
Inherited

This may be a new language or additional content for an existing language If the key 'clear' is true, then translations for the specified language will be replaced and added otherwise

inherited_from \Zend_Translate_Adapter::addTranslation()

Parameters

$options

array\Zend_Config

Options and translations to be added

Exceptions

\Zend_Translate_Exception

Returns

\Zend_Translate_AdapterProvides fluent interface

Clears all set cache data

clearCache(string $tag) : void
Inherited

inherited_from \Zend_Translate_Adapter::clearCache()

Parameters

$tag

string

Tag to clear when the default tag name is not used

Returns the set cache

getCache() : \Zend_Cache_Core
Inherited

inherited_from \Zend_Translate_Adapter::getCache()

Returns

\Zend_Cache_CoreThe set cache

Returns the available languages from this adapter

getList() : array | null
Inherited

inherited_from \Zend_Translate_Adapter::getList()

Returns

arraynull

Gets locale

getLocale() : \Zend_Locale | string | null
Inherited

inherited_from \Zend_Translate_Adapter::getLocale()

Returns

\Zend_Localestringnull

Returns the message id for a given translation If no locale is given, the actual language will be used

getMessageId(string $message, string | \Zend_Locale $locale) : string | array | false
Inherited

inherited_from \Zend_Translate_Adapter::getMessageId()

Parameters

$message

string

Message to get the key for

$locale

string\Zend_Locale

(optional) Language to return the message ids from

Returns

stringarrayfalse

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

getMessageIds(string | \Zend_Locale $locale) : array
Inherited

inherited_from \Zend_Translate_Adapter::getMessageIds()

Parameters

$locale

string\Zend_Locale

(optional) Language to return the message ids from

Returns

array

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

getMessages(string | \Zend_Locale $locale) : array
Inherited

inherited_from \Zend_Translate_Adapter::getMessages()

Parameters

$locale

string\Zend_Locale

(optional) Language to return the messages from

Returns

array

Returns the adapters name and it's options

getOptions(string | null $optionKey) : integer | string | array | null
Inherited

inherited_from \Zend_Translate_Adapter::getOptions()

Parameters

$optionKey

stringnull

String returns this option null returns all options

Returns

integerstringarraynull

Returns true when a cache is set

hasCache() : boolean
Inherited

inherited_from \Zend_Translate_Adapter::hasCache()

Returns

boolean

Is the wished language available ?

isAvailable(string | \Zend_Locale $locale) : boolean
Inherited

see \Zend_Locale
see \Zend_Locale
inherited_from \Zend_Translate_Adapter::isAvailable()

Parameters

$locale

string\Zend_Locale

Language to search for, identical with locale identifier,

Returns

boolean

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

isTranslated(string $messageId, boolean $original, string | \Zend_Locale $locale) : boolean
Inherited

inherited_from \Zend_Translate_Adapter::isTranslated()

Parameters

$messageId

string

Translation string

$original

boolean

(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

$locale

string\Zend_Locale

(optional) Locale/Language to use, identical with locale identifier, see Zend_Locale for more information

Returns

boolean

Translates the given string using plural notations Returns the translated string

plural(string $singular, string $plural, integer $number, string | \Zend_Locale $locale) : string
Inherited

see \Zend_Locale
inherited_from \Zend_Translate_Adapter::plural()

Parameters

$singular

string

Singular translation string

$plural

string

Plural translation string

$number

integer

Number for detecting the correct plural

$locale

string\Zend_Locale

(Optional) Locale/Language to use, identical with locale identifier, @see Zend_Locale for more information

Returns

string

Removes any set cache

removeCache() : void
Inherited

inherited_from \Zend_Translate_Adapter::removeCache()

Sets a cache for all Zend_Translate_Adapters

setCache(Zend_Cache_Core $cache) 
Inherited

inherited_from \Zend_Translate_Adapter::setCache()

Parameters

$cache

\Zend_Cache_Core

Cache to store to

Sets locale

setLocale(string | \Zend_Locale $locale) : \Zend_Translate_Adapter
Inherited

inherited_from \Zend_Translate_Adapter::setLocale()

Parameters

$locale

string\Zend_Locale

Locale to set

Exceptions

\Zend_Translate_Exception

Returns

\Zend_Translate_AdapterProvides fluent interface

Sets new adapter options

setOptions(array $options) : \Zend_Translate_Adapter
Inherited

inherited_from \Zend_Translate_Adapter::setOptions()

Parameters

$options

array

Adapter options

Exceptions

\Zend_Translate_Exception

Returns

\Zend_Translate_AdapterProvides fluent interface

returns the adapters name

toString() : string

Returns

string

Translates the given string returns the translation

translate(string | array $messageId, string | \Zend_Locale $locale) : string
Inherited

see \Zend_Locale
inherited_from \Zend_Translate_Adapter::translate()

Parameters

$messageId

stringarray

Translation string, or Array for plural translations

$locale

string\Zend_Locale

(optional) Locale/Language to use, identical with locale identifier, @see Zend_Locale for more information

Returns

string

Load translation data

_loadTranslationData(string | array $data, string $locale, array $options) : array

Parameters

$data

stringarray

$locale

string

Locale/Language to add data for, identical with locale identifier, see Zend_Locale for more information

$options

array

OPTIONAL Options to use

Returns

array

Logs a message when the log option is set

_log(string $message, String $locale) 
Inherited

inherited_from \Zend_Translate_Adapter::_log()

Parameters

$message

string

Message to log

$locale

String

Locale to log

Internal function for adding translation data

_addTranslationData($options) : \Zend_Translate_Adapter
Inherited

This may be a new language or additional data for an existing language If the options 'clear' is true, then the translation data for the specified language is replaced and added otherwise

see \Zend_Locale
inherited_from \Zend_Translate_Adapter::_addTranslationData()

Parameters

$options

Exceptions

\Zend_Translate_Exception

Returns

\Zend_Translate_AdapterProvides fluent interface

Internal method to check if the given cache supports tags

_getTagSupportForCache() 
Inherited

inherited_from \Zend_Translate_Adapter::_getTagSupportForCache()

 Properties

 

Internal cache for all adapters

$_cache : \Zend_Cache_Core
Inherited

inherited_from \Zend_Translate_Adapter::$$_cache
 

Array with all options, each adapter can have own additional options 'clear' => when true, clears already loaded translations when adding new files 'content' => content to translate or file or directory with content 'disableNotices' => when true, omits notices from being displayed 'ignore' => a prefix for files and directories which are not being added 'locale' => the actual set locale to use 'log' => a instance of Zend_Log where logs are written to 'logMessage' => message to be logged 'logPriority' => priority which is used to write the log message 'logUntranslated' => when true, untranslated messages are not logged 'reload' => reloads the cache by reading the content again 'scan' => searches for translation files using the LOCALE constants 'tag' => tag to use for the cache

$_options : array
Inherited

inherited_from \Zend_Translate_Adapter::$$_options
 

Translation table

$_translate : array
Inherited

inherited_from \Zend_Translate_Adapter::$$_translate
 

Shows if locale detection is in automatic level

$_automatic : boolean
Inherited

inherited_from \Zend_Translate_Adapter::$$_automatic
 

Internal value to remember if cache supports tags

$_cacheTags : boolean
Inherited

inherited_from \Zend_Translate_Adapter::$$_cacheTags
 

$_data

$_data 

 

Internal value to see already routed languages

$_routed : \array()
Inherited

inherited_from \Zend_Translate_Adapter::$$_routed

 Constants

 

Scans for the locale within the name of the directory

LOCALE_DIRECTORY 
Inherited

constant integer
inherited_from \Zend_Translate_Adapter::LOCALE_DIRECTORY
 

Scans for the locale within the name of the file

LOCALE_FILENAME 
Inherited

constant integer
inherited_from \Zend_Translate_Adapter::LOCALE_FILENAME