Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
eZTranslatorManager Class Reference
Internationalization » Translation

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

## Public Member Functions
| __construct ()
| findKey ( $key)
| findMessage ( $context, $source, $comment=null)
| keyTranslate ( $key)
| translate ( $context, $source, $comment=null)

## Static Public Member Functions
static | instance ()
static | registerHandler ( $handler)
static | createKey ( $context, $source, $comment=null)
static | createMessage ( $context, $source, $comment=null, $translation=null)
static | resetGlobals ()
static | resetTranslations ()
static | dynamicTranslationsEnabled ()
static | enableDynamicTranslations ( $enable=true)
static | setActiveTranslation ( $locale, $permanently=true)

## Public Attributes
const | DYNAMIC_TRANSLATIONS_ENABLED = 'eZTMDynamicTranslationsEnabled'
| $Handlers

## 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

Definition at line 31 of file eztranslatormanager.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZTranslatorManager::__construct | ( |  | ) |

Definition at line 35 of file eztranslatormanager.php.

## Member Function Documentation

## ◆ createKey()

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

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

Definition at line 151 of file eztranslatormanager.php.

## ◆ createMessage()

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

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

Definition at line 163 of file eztranslatormanager.php.

References $msg, and $translation.

## ◆ dynamicTranslationsEnabled()

static eZTranslatorManager::dynamicTranslationsEnabled | ( |  | ) |
| static

Definition at line 194 of file eztranslatormanager.php.

Referenced by setActiveTranslation().

## ◆ enableDynamicTranslations()

static eZTranslatorManager::enableDynamicTranslations | ( |  | $enable = `true` | ) |
| static

Definition at line 202 of file eztranslatormanager.php.

References DYNAMIC_TRANSLATIONS_ENABLED.

Referenced by ezpbKernelAdmin\requestInit(), ezpbKernelWeb\requestInit(), and ezpKernelWeb\requestInit().

## ◆ findKey()

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

Definition at line 51 of file eztranslatormanager.php.

References $i, and $msg.

## ◆ findMessage()

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

Definition at line 72 of file eztranslatormanager.php.

References $i, and $msg.

## ◆ instance()

static eZTranslatorManager::instance | ( |  | ) |
| static

Returns a shared instance of the eZTranslatorManager class.

Returns
  eZTranslatorManager

Definition at line 128 of file eztranslatormanager.php.

Referenced by eZ1337Translator\findMessage(), eZBorkTranslator\findMessage(), eZShuffleTranslator\findMessage(), eZTSTranslator\findMessage(), eZTSTranslator\initialize(), eZ1337Translator\initialize(), eZBorkTranslator\initialize(), eZTSTranslator\insert(), registerHandler(), and eZTSTranslator\remove().

## ◆ keyTranslate()

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

Definition at line 93 of file eztranslatormanager.php.

References $i.

## ◆ registerHandler()

static eZTranslatorManager::registerHandler | ( |  | $handler | ) |
| static

Registers the handler object $handler.

Definition at line 141 of file eztranslatormanager.php.

References $instance, and instance().

## ◆ resetGlobals()

static eZTranslatorManager::resetGlobals | ( |  | ) |
| static

Definition at line 175 of file eztranslatormanager.php.

Referenced by resetTranslations().

## ◆ resetTranslations()

static eZTranslatorManager::resetTranslations | ( |  | ) |
| static

Definition at line 183 of file eztranslatormanager.php.

References eZTranslationCache\resetGlobals(), resetGlobals(), and eZTSTranslator\resetGlobals().

Referenced by setActiveTranslation().

## ◆ setActiveTranslation()

static eZTranslatorManager::setActiveTranslation | ( |  | $locale,
|  |  | $permanently = `true`
| ) |  |
| static

Definition at line 217 of file eztranslatormanager.php.

References $locale, dynamicTranslationsEnabled(), and resetTranslations().

## ◆ translate()

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

Definition at line 110 of file eztranslatormanager.php.

References $i.

## Member Data Documentation

## ◆ $Handlers

eZTranslatorManager::$Handlers

The array of handler objects

Definition at line 243 of file eztranslatormanager.php.

## ◆ DYNAMIC_TRANSLATIONS_ENABLED

const eZTranslatorManager::DYNAMIC_TRANSLATIONS_ENABLED = 'eZTMDynamicTranslationsEnabled'

Definition at line 33 of file eztranslatormanager.php.

Referenced by enableDynamicTranslations().

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

- eztranslatormanager.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.