## Apache Zeta Components Manual :: Docs For Class ezcTranslation

### Translation::ezcTranslation

### Class ezcTranslation

ezcTranslation is a container that holds the translated strings for a specific context.

ezcTranslation objects are returned by the ezcTranslationManager for every requested context.

For an example see ezcTranslationManager.

Source for this file: /Translation/src/translation.php

Version: | //autogentag//

### Method Summary

public ezcTranslation | `__construct( $data )` Constructs the ezcTranslation object.
public string | `compileTranslation( $key , [ $params = array()] )` Returns the translated version of the original string $key.
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) |

#### compileTranslation

string compileTranslation( 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 with PHP code to place the variable data into the string at a later moment. Instead of the values for each of the parameters, an expression to get to the data should be sumbitted into the $params array.

1. echo$translation-> compileTranslation ("Hello #%nr",array("nr"=>'$this->send->nr') );

Will return something like:

1. 'Hallo #'.$this->send->nr.''

##### Parameters:

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

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

##### Exceptions:

Type | Description
--- | ---
`ezcTranslationParameterMissingException` | when not enough parameters are passed for a parameterized string
`ezcTranslationKeyNotAvailableException` | when the key is not available in the translation definitions

Documentation generated by phpDocumentor 1.4.3