eZPublish  3.8
eZTSTranslator Class Reference

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

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

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)
 
- Public Member Functions inherited from eZTranslatorHandler
 eZTranslatorHandler ($is_key_based)
 
 isKeyBased ()
 

Static Public Member Functions

initialize ($context, $locale, $filename, $useCache=true)
 
 validateDOMTree (&$tree)
 

Private Member Functions

 loadTranslationFile ($locale, $filename, $requestedContext)
 

Private Attributes

 $BuildCache
 
 $CachedMessages
 
 $File
 
 $Messages
 Contains the hash table with message translations. More...
 
 $UseCache
 

Detailed Description

This provides internationalization using XML (.ts) files.

Member Function Documentation

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

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

Referenced by initialize().

eZTSTranslator::findKey (   $key)
virtual

Implements eZTranslatorHandler.

Referenced by findMessage(), and keyTranslate().

eZTSTranslator::findMessage (   $context,
  $source,
  $comment = null 
)
virtual

Implements eZTranslatorHandler.

Referenced by translate().

eZTSTranslator::handleContextNode (   $context)

Referenced by loadTranslationFile().

eZTSTranslator::handleMessageNode (   $contextName,
$message 
)

Referenced by handleContextNode().

eZTSTranslator::hasInitializedContext (   $context)
Returns
true if the context $context is already initialized.
& eZTSTranslator::initialize (   $context,
  $locale,
  $filename,
  $useCache = true 
)
static

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

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.

Referenced by handleMessageNode().

eZTSTranslator::keyTranslate (   $key)
virtual

Implements eZTranslatorHandler.

eZTSTranslator::load (   $requestedContext)

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

eZTSTranslator::loadTranslationFile (   $locale,
  $filename,
  $requestedContext 
)
private

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.

eZTSTranslator::removeKey (   $key)

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

eZTSTranslator::translate (   $context,
  $source,
  $comment = null 
)
virtual

Implements eZTranslatorHandler.

eZTSTranslator::validateDOMTree ( $tree)
static

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

Warning
There's no validation done yet. It checks if $tree is object only. In all other cases it returns true for all DOM trees.

Referenced by loadTranslationFile().

Member Data Documentation

eZTSTranslator::$BuildCache
private
eZTSTranslator::$CachedMessages
private
eZTSTranslator::$File
private
eZTSTranslator::$Messages
private

Contains the hash table with message translations.

eZTSTranslator::$UseCache
private

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