API Documentation

Translate/Adapter/Tbx.php

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-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Translate  
version
$Id: Tbx.php 23775 2011-03-01 17:25:24Z ralph $  

\Zend_Translate_Adapter_Tbx

Basic adapter class for each translation source adapter

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

Properties

Propertyprivate  $_cleared= 'array'
Default valuearrayDetails
Type
Propertyprivate  $_content= 'null'
Default valuenullDetails
Type
Propertyprivate  $_data= 'array'
Default valuearrayDetails
Type
Propertyprivate  $_file= 'false'
Default valuefalseDetails
Type
Propertyprivate  $_langset= 'null'
Default valuenullDetails
Type
Propertyprivate  $_term= 'null'
Default valuenullDetails
Type
Propertyprivate  $_termentry= 'null'
Default valuenullDetails
Type

Methods

methodpublic_( string $messageId, string|\Zend_Locale $locale = null ) : string

Translates the given string returns the translation

Inherited from: \Zend_Translate_Adapter::_()
Parameters
Name Type Description
$messageId string Translation string
$locale string|\Zend_Locale

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

Returns
Type Description
string
methodpublic__construct( array|\Zend_Config $options = array ) : void

Generates the adapter

Inherited from: \Zend_Translate_Adapter::__construct()
Parameters
Name Type Description
$options array|\Zend_Config Translation options for this adapter
Throws
Exception Description
\Zend_Translate_Exception
methodprivate_addTranslationData(  $options = array ) : \Zend_Translate_Adapter

Internal function for adding translation data

Inherited from: \Zend_Translate_Adapter::_addTranslationData()

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

Parameters
Name Type Description
$options
Returns
Type Description
\Zend_Translate_Adapter Provides fluent interface
Throws
Exception Description
\Zend_Translate_Exception
Details
see
\Zend_Locale  
methodprivate_contentElement(  $file,  $data ) : void

Parameters
Name Type Description
$file
$data
methodprivate_endElement(  $file,  $name ) : void

Parameters
Name Type Description
$file
$name
methodprivate_findEncoding(  $filename ) : void

Parameters
Name Type Description
$filename
methodprivate_getTagSupportForCache( ) : void
static

Internal method to check if the given cache supports tags

Inherited from: \Zend_Translate_Adapter::_getTagSupportForCache()
methodprotected_loadTranslationData( string $filename, string $locale,  $options = array ) : array

Load translation data (TBX file reader)

Parameters
Name Type Description
$filename string TBX file to add, full path must be given for access
$locale string Locale has no effect for TBX because TBX defines all languages within the source file
$options
Returns
Type Description
array
Throws
Exception Description
\Zend_Translation_Exception
methodprotected_log( string $message, String $locale ) : void

Logs a message when the log option is set

Inherited from: \Zend_Translate_Adapter::_log()
Parameters
Name Type Description
$message string Message to log
$locale String Locale to log
methodprivate_startElement(  $file,  $name,  $attrib ) : void

Parameters
Name Type Description
$file
$name
$attrib
methodpublicaddTranslation( array|\Zend_Config $options = array ) : \Zend_Translate_Adapter

Add translations

Inherited from: \Zend_Translate_Adapter::addTranslation()

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

Parameters
Name Type Description
$options array|\Zend_Config Options and translations to be added
Returns
Type Description
\Zend_Translate_Adapter Provides fluent interface
Throws
Exception Description
\Zend_Translate_Exception
methodpublicclearCache( string $tag = null ) : void
static

Clears all set cache data

Inherited from: \Zend_Translate_Adapter::clearCache()
Parameters
Name Type Description
$tag string Tag to clear when the default tag name is not used
methodpublicgetCache( ) : \Zend_Cache_Core
static

Returns the set cache

Inherited from: \Zend_Translate_Adapter::getCache()
Returns
Type Description
\Zend_Cache_Core The set cache
methodpublicgetList( ) : array|null

Returns the available languages from this adapter

Inherited from: \Zend_Translate_Adapter::getList()
Returns
Type Description
arraynull
methodpublicgetLocale( ) : \Zend_Locale|string|null

Gets locale

Inherited from: \Zend_Translate_Adapter::getLocale()
Returns
Type Description
\Zend_Localestringnull
methodpublicgetMessageId( string $message, string|\Zend_Locale $locale = null ) : string|array|false

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

Inherited from: \Zend_Translate_Adapter::getMessageId()
Parameters
Name Type Description
$message string Message to get the key for
$locale string|\Zend_Locale

(optional) Language to return the message ids from

Returns
Type Description
stringarrayfalse
methodpublicgetMessageIds( string|\Zend_Locale $locale = null ) : array

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

Inherited from: \Zend_Translate_Adapter::getMessageIds()
Parameters
Name Type Description
$locale string|\Zend_Locale

(optional) Language to return the message ids from

Returns
Type Description
array
methodpublicgetMessages( string|\Zend_Locale $locale = null ) : 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

Inherited from: \Zend_Translate_Adapter::getMessages()
Parameters
Name Type Description
$locale string|\Zend_Locale

(optional) Language to return the messages from

Returns
Type Description
array
methodpublicgetOptions( string|null $optionKey = null ) : integer|string|array|null

Returns the adapters name and it's options

Inherited from: \Zend_Translate_Adapter::getOptions()
Parameters
Name Type Description
$optionKey string|null String returns this option null returns all options
Returns
Type Description
integerstringarraynull
methodpublichasCache( ) : boolean
static

Returns true when a cache is set

Inherited from: \Zend_Translate_Adapter::hasCache()
Returns
Type Description
boolean
methodpublicisAvailable( string|\Zend_Locale $locale ) : boolean

Is the wished language available ?

Inherited from: \Zend_Translate_Adapter::isAvailable()
Parameters
Name Type Description
$locale string|\Zend_Locale Language to search for, identical with locale identifier,
Returns
Type Description
boolean
Details
see
\Zend_Locale  
see
\Zend_Locale  
methodpublicisTranslated( string $messageId, boolean $original = false, string|\Zend_Locale $locale = null ) : boolean

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

Inherited from: \Zend_Translate_Adapter::isTranslated()
Parameters
Name Type Description
$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
Type Description
boolean
methodpublicplural( string $singular, string $plural, integer $number, string|\Zend_Locale $locale = null ) : string

Translates the given string using plural notations Returns the translated string

Inherited from: \Zend_Translate_Adapter::plural()
Parameters
Name Type Description
$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
Type Description
string
Details
see
\Zend_Locale  
methodpublicremoveCache( ) : void
static

Removes any set cache

Inherited from: \Zend_Translate_Adapter::removeCache()
methodpublicsetCache( \Zend_Cache_Core $cache ) : void
static

Sets a cache for all Zend_Translate_Adapters

Inherited from: \Zend_Translate_Adapter::setCache()
Parameters
Name Type Description
$cache \Zend_Cache_Core Cache to store to
methodpublicsetLocale( string|\Zend_Locale $locale ) : \Zend_Translate_Adapter

Sets locale

Inherited from: \Zend_Translate_Adapter::setLocale()
Parameters
Name Type Description
$locale string|\Zend_Locale Locale to set
Returns
Type Description
\Zend_Translate_Adapter Provides fluent interface
Throws
Exception Description
\Zend_Translate_Exception
methodpublicsetOptions( array $options = array ) : \Zend_Translate_Adapter

Sets new adapter options

Inherited from: \Zend_Translate_Adapter::setOptions()
Parameters
Name Type Description
$options array Adapter options
Returns
Type Description
\Zend_Translate_Adapter Provides fluent interface
Throws
Exception Description
\Zend_Translate_Exception
methodpublictoString( ) : string

Returns the adapter name

Returns
Type Description
string
methodpublictranslate( string|array $messageId, string|\Zend_Locale $locale = null ) : string

Translates the given string returns the translation

Inherited from: \Zend_Translate_Adapter::translate()
Parameters
Name Type Description
$messageId string|array 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
Type Description
string
Details
see
\Zend_Locale  
Documentation was generated by DocBlox 0.13.3.