eZPublish  3.9
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

 createKey ($context, $source, $comment=null)
 
 createMessage ($context, $source, $comment=null, $translation=null)
 
 dynamicTranslationsEnabled ()
 
 enableDynamicTranslations ($enable=true)
 
instance ()
 
 registerHandler (&$handler)
 
 resetGlobals ()
 
 resetTranslations ()
 
 setActiveTranslation ($locale, $permanently=true)
 

Private Attributes

 $Handlers
 The array of handler objects. More...
 

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

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

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

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

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

eZTranslatorManager::dynamicTranslationsEnabled ( )
static

Referenced by setActiveTranslation().

eZTranslatorManager::enableDynamicTranslations (   $enable = true)
static

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,
  $source,
  $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)
Returns
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
eZTranslatorManager::registerHandler ( $handler)
static

Registers the handler object $handler.

eZTranslatorManager::resetGlobals ( )
static

Referenced by resetTranslations().

eZTranslatorManager::resetTranslations ( )
static

Referenced by setActiveTranslation().

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

Member Data Documentation

eZTranslatorManager::$Handlers
private

The array of handler objects.


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