Translator.

 Methods

Add remote translations.

addRemoteTranslations(string $type, string $textDomain) : \Zend\I18n\Translator\Translator
Inherited

inherited_from \Zend\I18n\Translator\Translator::addRemoteTranslations()

Parameters

$type

string

$textDomain

string

Returns

Add a translation file.

addTranslationFile(string $type, string $filename, string $textDomain, string $locale) : \Zend\I18n\Translator\Translator
Inherited

inherited_from \Zend\I18n\Translator\Translator::addTranslationFile()

Parameters

$type

string

$filename

string

$textDomain

string

$locale

string

Returns

Add multiple translations with a file pattern.

addTranslationFilePattern(string $type, string $baseDir, string $pattern, string $textDomain) : \Zend\I18n\Translator\Translator
Inherited

inherited_from \Zend\I18n\Translator\Translator::addTranslationFilePattern()

Parameters

$type

string

$baseDir

string

$pattern

string

$textDomain

string

Returns

Disable the event manager.

disableEventManager() : \Zend\I18n\Translator\Translator
Inherited

inherited_from \Zend\I18n\Translator\Translator::disableEventManager()

Returns

Enable the event manager.

enableEventManager() : \Zend\I18n\Translator\Translator
Inherited

inherited_from \Zend\I18n\Translator\Translator::enableEventManager()

Returns

Instantiate a translator

factory(array | \Traversable $options) : \Zend\I18n\Translator\Translator
Inherited

inherited_from \Zend\I18n\Translator\Translator::factory()

Parameters

$options

array\Traversable

Exceptions

\Zend\I18n\Exception\InvalidArgumentException

Returns

Returns the set cache

getCache() : \Zend\Cache\Storage\StorageInterface
Inherited

inherited_from \Zend\I18n\Translator\Translator::getCache()

Returns

Get the event manager.

getEventManager() : \Zend\EventManager\EventManagerInterface | null
Inherited

inherited_from \Zend\I18n\Translator\Translator::getEventManager()

Returns

Get the fallback locale.

getFallbackLocale() : string
Inherited

inherited_from \Zend\I18n\Translator\Translator::getFallbackLocale()

Returns

string

Get the default locale.

getLocale() : string
Inherited

inherited_from \Zend\I18n\Translator\Translator::getLocale()

Exceptions

\Zend\I18n\Exception\ExtensionNotLoadedException if ext/intl is not present and no locale set

Returns

string

Retrieve the plugin manager for translation loaders.

getPluginManager() : \Zend\I18n\Translator\LoaderPluginManager
Inherited

Lazy loads an instance if none currently set.

inherited_from \Zend\I18n\Translator\Translator::getPluginManager()

Returns

Check whether the event manager is enabled.

isEventManagerEnabled() : boolean
Inherited

inherited_from \Zend\I18n\Translator\Translator::isEventManagerEnabled()

Returns

boolean

Sets a cache

setCache(\Zend\Cache\Storage\StorageInterface $cache) : \Zend\I18n\Translator\Translator
Inherited

inherited_from \Zend\I18n\Translator\Translator::setCache()

Parameters

Returns

Set the event manager instance used by this translator.

setEventManager(\Zend\EventManager\EventManagerInterface $events) : \Zend\I18n\Translator\Translator
Inherited

inherited_from \Zend\I18n\Translator\Translator::setEventManager()

Parameters

Returns

Set the fallback locale.

setFallbackLocale(string $locale) : \Zend\I18n\Translator\Translator
Inherited

inherited_from \Zend\I18n\Translator\Translator::setFallbackLocale()

Parameters

$locale

string

Returns

Set the default locale.

setLocale(string $locale) : \Zend\I18n\Translator\Translator
Inherited

inherited_from \Zend\I18n\Translator\Translator::setLocale()

Parameters

$locale

string

Returns

Set the plugin manager for translation loaders

setPluginManager(\Zend\I18n\Translator\LoaderPluginManager $pluginManager) : \Zend\I18n\Translator\Translator
Inherited

inherited_from \Zend\I18n\Translator\Translator::setPluginManager()

Parameters

Returns

Translate a message.

translate(string $message, string $textDomain, string $locale) : string
Inherited

inherited_from \Zend\Validator\Translator\TranslatorInterface::translate()

Parameters

$message

string

$textDomain

string

$locale

string

Returns

string

Translate a plural message.

translatePlural(string $singular, string $plural, int $number, string $textDomain, string | null $locale) : string
Inherited

inherited_from \Zend\I18n\Translator\Translator::translatePlural()

Parameters

$singular

string

$plural

string

$number

int

$textDomain

string

$locale

stringnull

Exceptions

\Zend\I18n\Exception\OutOfBoundsException

Returns

string

Get a translated message.

getTranslatedMessage(string $message, string $locale, string $textDomain) : string | null
Inherited

triggers getTranslatedMessage.missing-translation
inherited_from \Zend\I18n\Translator\Translator::getTranslatedMessage()

Parameters

$message

string

$locale

string

$textDomain

string

Returns

stringnull

Load messages for a given language and domain.

loadMessages(string $textDomain, string $locale) : void
Inherited

triggers loadMessages.no-messages-loaded
inherited_from \Zend\I18n\Translator\Translator::loadMessages()

Parameters

$textDomain

string

$locale

string

Exceptions

\Zend\I18n\Exception\RuntimeException

Load messages from files.

loadMessagesFromFiles(string $textDomain, string $locale) : bool
Inherited

inherited_from \Zend\I18n\Translator\Translator::loadMessagesFromFiles()

Parameters

$textDomain

string

$locale

string

Exceptions

\Zend\I18n\Exception\RuntimeException When specified loader is not a file loader

Returns

bool

Load messages from patterns.

loadMessagesFromPatterns(string $textDomain, string $locale) : bool
Inherited

inherited_from \Zend\I18n\Translator\Translator::loadMessagesFromPatterns()

Parameters

$textDomain

string

$locale

string

Exceptions

\Zend\I18n\Exception\RuntimeException When specified loader is not a file loader

Returns

bool

Load messages from remote sources.

loadMessagesFromRemote(string $textDomain, string $locale) : bool
Inherited

inherited_from \Zend\I18n\Translator\Translator::loadMessagesFromRemote()

Parameters

$textDomain

string

$locale

string

Exceptions

\Zend\I18n\Exception\RuntimeException When specified loader is not a remote loader

Returns

bool

 Properties

 

Translation cache.

$cache : \Zend\Cache\Storage\StorageInterface
Inherited

inherited_from \Zend\I18n\Translator\Translator::$$cache
 

Event manager for triggering translator events.

$events : \Zend\EventManager\EventManagerInterface
Inherited

inherited_from \Zend\I18n\Translator\Translator::$$events
 

Whether events are enabled

$eventsEnabled : bool
Inherited

inherited_from \Zend\I18n\Translator\Translator::$$eventsEnabled
 

Locale to use as fallback if there is no translation.

$fallbackLocale : string
Inherited

inherited_from \Zend\I18n\Translator\Translator::$$fallbackLocale
 

Files used for loading messages.

$files : array
Inherited

inherited_from \Zend\I18n\Translator\Translator::$$files
 

Default locale.

$locale : string
Inherited

inherited_from \Zend\I18n\Translator\Translator::$$locale
 

Messages loaded by the translator.

$messages : array
Inherited

inherited_from \Zend\I18n\Translator\Translator::$$messages
 

Patterns used for loading messages.

$patterns : array
Inherited

inherited_from \Zend\I18n\Translator\Translator::$$patterns
 

Plugin manager for translation loaders.

$pluginManager : \Zend\I18n\Translator\LoaderPluginManager
Inherited

inherited_from \Zend\I18n\Translator\Translator::$$pluginManager
 

Remote locations for loading messages.

$remote : array
Inherited

inherited_from \Zend\I18n\Translator\Translator::$$remote

 Constants

 

Event fired when the translation for a message is missing.

EVENT_MISSING_TRANSLATION 
Inherited

inherited_from \Zend\I18n\Translator\Translator::EVENT_MISSING_TRANSLATION
 

Event fired when no messages were loaded for a locale/text-domain combination.

EVENT_NO_MESSAGES_LOADED 
Inherited

inherited_from \Zend\I18n\Translator\Translator::EVENT_NO_MESSAGES_LOADED