eZ Publish  [4.2]
eZTSTranslator Class Reference

This provides internationalization using XML (.ts) files. More...

+ Inheritance diagram for eZTSTranslator:
+ Collaboration diagram for eZTSTranslator:

List of all members.

Public Member Functions

 eZTSTranslator ($locale, $filename=null, $useCache=true)
 findKey ($key)
 findMessage ($context, $source, $comment=null)
 handleContextNode ($context)
 handleMessageNode ($contextName, $message)
 hasInitializedContext ($context)
 insert ($context, $source, $translation, $comment=null)
 keyTranslate ($key)
 load ($requestedContext)
 remove ($context, $source, $message=null)
 removeKey ($key)
 translate ($context, $source, $comment=null)

Static Public Member Functions

static expireCache ($timestamp=false)
 Contains the hash table with message translations.
static fetchList ($localeList=array())
static initialize ($context, $locale, $filename, $useCache=true)
static resetGlobals ()
static validateDOMTree ($tree)

Public Attributes

 $BuildCache
 $CachedMessages
 $File
 $Messages
 $UseCache

Private Member Functions

 loadTranslationFile ($locale, $filename, $requestedContext)

Private Attributes

const EXPIRY_KEY = 'ts-translation-cache'
 Translation expiry key used by eZExpiryHandler to manage translation caches.

Static Private Attributes

static $expiryTimestamp = false

Detailed Description

This provides internationalization using XML (.ts) files.

Definition at line 41 of file eztstranslator.php.


Member Function Documentation

static eZTSTranslator::expireCache ( timestamp = false) [static]

Contains the hash table with message translations.

Expires the translation cache

Parameters:
int$timestampAn optional timestamp cache should be exired from. Current timestamp used by default
Returns:
void

Definition at line 695 of file eztstranslator.php.

Referenced by eZCache\clearTSTranslationCache(), and loadTranslationFile().

eZTSTranslator::eZTSTranslator ( locale,
filename = null,
useCache = true 
)

Construct the translator and loads the translation file $file if it is set and exists.

Definition at line 46 of file eztstranslator.php.

Referenced by fetchList(), and initialize().

static eZTSTranslator::fetchList ( localeList = array()) [static]

Fetche list of available translations, create eZTrnslator for each translations.

Returns:
list of eZTranslator objects representing available translations.

Definition at line 644 of file eztstranslator.php.

eZTSTranslator::findKey ( key) [virtual]
Returns:
the translation message for the key $key or null if the key does not exist.

This function must overridden if isKeyBased() is true.

Implements eZTranslatorHandler.

Definition at line 538 of file eztstranslator.php.

Referenced by findMessage(), and keyTranslate().

eZTSTranslator::findMessage ( context,
source,
comment = null 
) [virtual]
Returns:
the translation message for $source and $context or null if the key does not exist.

If you know the translation key use findKey() instead.

This function must overridden if isKeyBased() is true.

Implements eZTranslatorHandler.

Definition at line 548 of file eztstranslator.php.

Referenced by translate().

eZTSTranslator::handleContextNode ( context)

Definition at line 388 of file eztstranslator.php.

Referenced by loadTranslationFile().

eZTSTranslator::handleMessageNode ( contextName,
message 
)

Definition at line 448 of file eztstranslator.php.

Referenced by handleContextNode().

eZTSTranslator::hasInitializedContext ( context)
Returns:
true if the context $context is already initialized.

Definition at line 103 of file eztstranslator.php.

static eZTSTranslator::initialize ( context,
locale,
filename,
useCache = true 
) [static]

Initialize the ts translator and context if this is not already done.

Definition at line 73 of file eztstranslator.php.

Referenced by eZi18nOperator\i18nTrans().

eZTSTranslator::insert ( context,
source,
translation,
comment = null 
)

Inserts the $translation for the $context and $source as a translation message and returns the key for the message. If $comment is non-null it will be included in the message.

If the translation message exists no new message is created and the existing key is returned.

Definition at line 591 of file eztstranslator.php.

Referenced by handleMessageNode().

eZTSTranslator::keyTranslate ( key) [virtual]
Returns:
the translation string for $key or null if the translation does not exist.
See also:
findMessage, findKey

Implements eZTranslatorHandler.

Definition at line 563 of file eztstranslator.php.

eZTSTranslator::load ( requestedContext)

Tries to load the context $requestedContext for the translation and returns true if was successful.

Definition at line 111 of file eztstranslator.php.

eZTSTranslator::loadTranslationFile ( locale,
filename,
requestedContext 
) [private]

Definition at line 119 of file eztstranslator.php.

Referenced by load().

eZTSTranslator::remove ( context,
source,
message = null 
)

Removes the translation message with $context and $source. Returns true if the message was removed, false otherwise.

If you have the translation key use removeKey() instead.

Definition at line 619 of file eztstranslator.php.

eZTSTranslator::removeKey ( key)

Removes the translation message with $key. Returns true if the message was removed, false otherwise.

Definition at line 633 of file eztstranslator.php.

static eZTSTranslator::resetGlobals ( ) [static]

Definition at line 681 of file eztstranslator.php.

eZTSTranslator::translate ( context,
source,
comment = null 
) [virtual]
Returns:
the translation string for $source and $context or null if the translation does not exist.
See also:
findMessage, findKey

Implements eZTranslatorHandler.

Definition at line 574 of file eztstranslator.php.

static eZTSTranslator::validateDOMTree ( tree) [static]

Validates the DOM tree $tree and returns true if it is correct.

Definition at line 378 of file eztstranslator.php.

Referenced by loadTranslationFile().


Member Data Documentation

eZTSTranslator::$BuildCache

Definition at line 711 of file eztstranslator.php.

eZTSTranslator::$CachedMessages

Definition at line 712 of file eztstranslator.php.

eZTSTranslator::$expiryTimestamp = false [static, private]

Definition at line 723 of file eztstranslator.php.

Referenced by loadTranslationFile().

eZTSTranslator::$File

Definition at line 709 of file eztstranslator.php.

eZTSTranslator::$Messages

Definition at line 708 of file eztstranslator.php.

eZTSTranslator::$UseCache

Definition at line 710 of file eztstranslator.php.

const eZTSTranslator::EXPIRY_KEY = 'ts-translation-cache' [private]

Translation expiry key used by eZExpiryHandler to manage translation caches.

Definition at line 717 of file eztstranslator.php.


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