Classes, interfaces and traits

Configuration

Configuration definition for the translations.

« More »

ServiceProvider

Registers all components for the translator to work.

This provider registers the following service:

  • translator, provides translation services

In addition to the above service the following parameters are registered as well:

  • translator.locale, contains the current locale.
« More »

Translator

Translator proxy for phpDocumentor.

This class encapsulates (or actually extends) a Translator object that can be used to translate messages from the fallback language to another.

This encapsulation serves two purposes;

  1. To make a migration to another translator easier if necessary
  2. To fix a bug in Zend\I18n\Translator\Translator where the cache is not cleared when new messages are added.

Due to issue 2 this class extends the Zend Translator and does not use composition to proxy calls to the translator; as such it is not recommended to use any public function not defined in this proxy as it may be removed.

Before invoking the \phpDocumentor\Translator\self::translate() method the user must first load a series of translation messages in the desired locale; this can be done by invoking the \phpDocumentor\Translator\self::addTranslationFile() or \phpDocumentor\Translator\self::addTranslationFolder() methods. These try to include a file containing a plain PHP Array and merge that with the translation table of this translator.

An example of a translation file can be:

return array(
    'KEY' => 'translated message',
);
« More »