Path

ez components / documentation / api reference / 2008.2.3 / translation


eZ Components 2008.2.3

Translation: ezcTranslationContextRead

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

Interface: ezcTranslationContextRead

Common interface for all context readers. [source]
This interface specifies the methods that a backend should implement if it wants to act as a general purpose translation context reader. It extends on the built-in Iterator interface.
Example (see ezcTranslationTsBackend for a more elaborate example):
 1.  <?php
 2.      $r new ezcTranslationTsBackend'usr/share/translations' );
 3.      $r->setOptionsarray'format' => 'translation-[LOCALE].xml' ) );
 4.      $r->initReader'nl_NL' );
 5.      $r->next();
 6.      while $r->valid() )
 7.      {
 8.          $ctxt $r->current();
 9.          $r->next();
10.      }
11.      $r->deinitReader();
12.  ?>

Parents

Iterator
   |
   --ezcTranslationContextRead

Method Summary

public void deinitReader( )
Deinitializes the reader.
public void initReader( $locale )
Initializes the reader to read from the locale $locale.

Methods

deinitReader

void deinitReader( )
Deinitializes the reader.
This method should be called after the haveMore() method returns false to cleanup resources.

Throws

ClassDescription
TranslationException when the reader is not initialized with initReader().

initReader

void initReader( string $locale )
Initializes the reader to read from the locale $locale.
Before starting to request context through the reader, you should call this method to initialize it.

Parameters

Name Type Description
$locale string  

Throws

ClassDescription
TranslationException when the path of the translation and the fileformat of the translation are not set before this method is called.

Last updated: Mon, 11 May 2009