Arbit - project tracking

Arbit - project tracking

API documentation :: Docs For Class arbitCachingTranslationContext

Core::View::arbitCachingTranslationContext

Class arbitCachingTranslationContext

Translation manager for arbit.

Translation manager for arbit. Handles multiple backends for caching of the translations, and creates translation file entries for missing translation items.

Author(s):
Version:   $Revision: 1236 $
License:   GPL

Descendants

Child Class Description
arbitDummyTranslationContext Translation manager for arbit.

Member Variables

protected ezcTranslationBackend $backend
Translation backend

Translation backend

protected string $context
Translation striing context

Translation striing context

protected string $locale
Current translation locale

Current translation locale

protected ezcTranslation $translation
Translation object

Translation object

Method Summary

public void __construct( $translation , $backend , $locale , $context )
Construct caching translation context Construct from translation backend and the actual translation.
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.
protected void replaceKeys( $key , $params )
Replace keys in translation strings Replace all keys in the translation strings. sign and are followed by alsphanumeric characters. the corresponding entries ind the $params array.

Methods

__construct

void __construct( $translation , $backend , string $locale , string $context )

Construct caching translation context Construct from translation backend and the actual translation.

Construct caching translation context Construct from translation backend and the actual translation.

Parameters:
Name Type Description
$translation ezcTranslation
$backend ezcTranslationBackend
$locale string
$context string
Redefined in descendants as:
Method Description
arbitDummyTranslationContext::__construct() Construct caching translation context Construct from translation backend and the actual translation. 

compileTranslation

string compileTranslation( string $key , [ $params = array()] )

Returns the translated version of the original string $key.

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.

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
Redefined in descendants as:
Method Description
arbitDummyTranslationContext::getTranslation() Returns the translated version of the original string $key. 

replaceKeys

void replaceKeys( mixed $key , $params )

Replace keys in translation strings Replace all keys in the translation strings. sign and are followed by alsphanumeric characters. the corresponding entries ind the $params array.

Replace keys in translation strings Replace all keys in the translation strings. Keys start with a percent sign and are followed by alsphanumeric characters. They are replaced by the corresponding entries ind the $params array.

Parameters:
Name Type Description
$key mixed
$params array
Documentation generated on Mon, 05 Apr 2010 14:01:39 +0200 by phpDocumentor 1.4.3