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

### Translation::ezcTranslationContextRead

### Interface ezcTranslationContextRead

Common interface for all context readers.

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->setOptions(array('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. ?>

Source for this file: /Translation/src/interfaces/context_read_interface.php

    Iterator
       |
       --ezcTranslationContextRead

Version: | //autogentag//

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

##### Exceptions:

Type | Description
--- | ---
`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 |

##### Exceptions:

Type | Description
--- | ---
`TranslationException` | when the path of the translation and the fileformat of the translation are not set before this method is called.

Documentation generated by phpDocumentor 1.4.3