Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Public Member Functions | Public Attributes | List of all members
eZTranslatorGroup Class Referenceabstract
Internationalization » Translation

Allows for picking translator handlers according to context. More...

Inheritance diagram for eZTranslatorGroup:

## Public Member Functions
| __construct ( $is_key_based)
| findKey ( $key)
| findMessage ( $context, $source, $comment=null)
| translate ( $context, $source, $comment=null)
| keyTranslate ( $key)
| keyPick ( $key)
| pick ( $context, $source, $comment)
| handlerCount ()
| registerHandler ( $handler)
Public Member Functions inherited from eZTranslatorHandler
| isKeyBased ()

## Public Attributes
| $Handlers
Public Attributes inherited from eZTranslatorHandler
| $IsKeyBased

## Detailed Description

Allows for picking translator handlers according to context.

Definition at line 18 of file eztranslatorgroup.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZTranslatorGroup::__construct | ( |  | $is_key_based | ) |

Constructor

Parameters

  bool | $is_key_based |

Reimplemented from eZTranslatorHandler.

Reimplemented in eZRandomTranslator.

Definition at line 20 of file eztranslatorgroup.php.

## Member Function Documentation

## ◆ findKey()

eZTranslatorGroup::findKey | ( |  | $key | ) |
| pure 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 32 of file eztranslatorgroup.php.

References keyPick().

## ◆ findMessage()

eZTranslatorGroup::findMessage | ( |  | $context,
|  |  | $source,
|  |  | $comment = `null`
| ) |  |
| pure 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 52 of file eztranslatorgroup.php.

References pick().

## ◆ handlerCount()

eZTranslatorGroup::handlerCount | ( |  | ) |

Returns
  the number of registered handlers.

Definition at line 123 of file eztranslatorgroup.php.

Referenced by eZRandomTranslator\keyPick(), and eZRandomTranslator\pick().

## ◆ keyPick()

eZTranslatorGroup::keyPick | ( |  | $key | ) |
| pure virtual

Reimplement this to pick one of the registered handlers based on $key.

Returns
  -1 for no handler or a number within the handler range (starting from 0).

See also
  pick

Implemented in eZRandomTranslator.

Definition at line 106 of file eztranslatorgroup.php.

Referenced by findKey(), and keyTranslate().

## ◆ keyTranslate()

eZTranslatorGroup::keyTranslate | ( |  | $key | ) |
| pure virtual

Returns
  the translation string for $key or null if the translation does not exist.

See also
  findMessage, findKey

Implements eZTranslatorHandler.

Definition at line 88 of file eztranslatorgroup.php.

References keyPick().

## ◆ pick()

eZTranslatorGroup::pick | ( |  | $context,
|  |  | $source,
|  |  | $comment
| ) |  |
| pure virtual

Reimplement this to pick one of the registered handlers based on $context, $source and $comment.

Returns
  -1 for no handler or a number within the handler range (starting from 0).

See also
  keyPick

Implemented in eZRandomTranslator.

Definition at line 116 of file eztranslatorgroup.php.

Referenced by findMessage(), and translate().

## ◆ registerHandler()

eZTranslatorGroup::registerHandler | ( |  | $handler | ) |

Registers the handler object $handler.

Definition at line 131 of file eztranslatorgroup.php.

References eZTranslatorHandler\isKeyBased(), and eZDebug\writeError().

## ◆ translate()

eZTranslatorGroup::translate | ( |  | $context,
|  |  | $source,
|  |  | $comment = `null`
| ) |  |
| pure 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 70 of file eztranslatorgroup.php.

References pick().

## Member Data Documentation

## ◆ $Handlers

eZTranslatorGroup::$Handlers

The array of grouped handlers

Definition at line 144 of file eztranslatorgroup.php.

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

- eztranslatorgroup.php

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