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;
To make a migration to another translator easier if necessary
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.
This type is hardcoded into a constant to simplify the signature of the addTranslationFile and
addTranslationFilePattern methods. This will simplify the migration to another component in the future as an
incompatibility between two libraries may emerge due to differing types or typenames.
This translator class may be used by plugin developers to have translating elements in their plugins; as such
the signatures here are considered to be stable / api.
DEFAULT_LOCALE
DEFAULT_LOCALE = 'en' : string
DEFAULT_DOMAIN
DEFAULT_DOMAIN = 'default' : string
DEFAULT_PATTERN
DEFAULT_PATTERN = '%s.php' : string
Methods
__construct()
__construct()
Pre-set the translator with the default locale as fallback.