Path

ez components / documentation / api reference / 2007.2.1 / translation


eZ Components 2007.2.1

Translation: ezcTranslation

[ Tutorial ] [ Linguist format ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcTranslation

ezcTranslation is a container that holds the translated strings for a specific context. [source]
ezcTranslation objects are returned by the ezcTranslationManager for every requested context.
For an example see ezcTranslationManager.

Method Summary

public ezcTranslation __construct( $data )
Constructs the ezcTranslation object.
public string getTranslation( $key, [$params = array()] )
Returns the translated version of the original string $key.

Methods

__construct

ezcTranslation __construct( $data )
Constructs the ezcTranslation object.
The constructor receives an array containing the translation elements, and builds up an internal map between the original string and the accompanying translation data.

Parameters

Name Type Description
$data array(ezcTranslationData)  

getTranslation

string getTranslation( string $key, [ $params = array()] )
Returns the translated version of the original string $key.
This method returns a translated string and substitutes the parameters $param in the localized string.

Parameters

Name Type Description
$key string  
$params array(string=>string)  

Throws

ClassDescription
ezcTranslationKeyNotAvailableException when the key is not available
ezcTranslationParameterMissingException when not enough parameters are passed for a parameterized string

Last updated: Thu, 31 Jan 2008