eZPublish  4.5
eZTranslatorManager Class Reference

This provides internationalization support for text output. More...

Public Member Functions

 eZTranslatorManager ()
 findKey ($key)
 findMessage ($context, $source, $comment=null)
 keyTranslate ($key)
 translate ($context, $source, $comment=null)

Static Public Member Functions

static createKey ($context, $source, $comment=null)
static createMessage ($context, $source, $comment=null, $translation=null)
static dynamicTranslationsEnabled ()
static enableDynamicTranslations ($enable=true)
static instance ()
 Returns a shared instance of the eZTranslatorManager class. More...
static registerHandler ($handler)
static resetGlobals ()
static resetTranslations ()
static setActiveTranslation ($locale, $permanently=true)

Public Attributes

 The array of handler objects. More...
const DYNAMIC_TRANSLATIONS_ENABLED = 'eZTMDynamicTranslationsEnabled'

Detailed Description

This provides internationalization support for text output.

Each message consists of:

  • context - the context of the translation
  • source - the source string
  • comment - a variation of the context/source
  • key - the uniquely generated key taken from context, source and eventually comment

Member Function Documentation

static eZTranslatorManager::createKey (   $context,
  $comment = null 

Creates an md5 key based on the $context, $source and $comment and returns it.

static eZTranslatorManager::createMessage (   $context,
  $comment = null,
  $translation = null 

Creates a message structure out of $context, $source and $comment and returns it.

static eZTranslatorManager::dynamicTranslationsEnabled ( )
static eZTranslatorManager::enableDynamicTranslations (   $enable = true)

Referenced by eZCheckValidity().

eZTranslatorManager::eZTranslatorManager ( )

Referenced by instance().

eZTranslatorManager::findKey (   $key)

Tries to find the translation message that matches $key in all it's handlers and returns it. If no message could be found it either means that none of the handlers have a translation for the key or that some of the handlers are not key based, for instance realtime translators. In the latter case an extra call to findMessage() or translate() is required.

Use keyTranslate if you only want to translate a message.

See Also
findMessage, keyTranslate
eZTranslatorManager::findMessage (   $context,
  $comment = null 

Tries to find the translation message that matches $context, $source and $comment. If that fails it tries $context and $source only. The message is then returned or null if no translation message could be found/generated for it.

Use translate if you only want to translate a message.

See Also
findKey, translate
eZTranslatorManager::keyTranslate (   $key)
the translation string for $key.

Note this returns the exact translation for the given key, use translate() instead if you want to have variable comment support.

See Also
findKey, translate
static eZTranslatorManager::registerHandler (   $handler)

Registers the handler object $handler.

static eZTranslatorManager::resetGlobals ( )

Referenced by resetTranslations().

static eZTranslatorManager::resetTranslations ( )

Referenced by setActiveTranslation().

static eZTranslatorManager::setActiveTranslation (   $locale,
  $permanently = true 
eZTranslatorManager::translate (   $context,
  $comment = null 
the translation string for $source and $context or null if the key does not exist.
See Also
findMessage, findKey

Member Data Documentation


The array of handler objects.

const eZTranslatorManager::DYNAMIC_TRANSLATIONS_ENABLED = 'eZTMDynamicTranslationsEnabled'

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