Class Translator

Summary

Fully Qualified Name: Zend\I18n\Translator\Translator
Implements: TranslatorInterface

Description

Translator.

Methods

Name Description Defined By
addRemoteTranslations() Add remote translations. Translator
addTranslationFile() Add a translation file. Translator
addTranslationFilePattern() Add multiple translations with a file pattern. Translator
clearCache() Clears the cache for a specific textDomain and locale. Translator
disableEventManager() Disable the event manager. Translator
enableEventManager() Enable the event manager. Translator
factory() Instantiate a translator Translator
getAllMessages() Return all the messages. Translator
getCache() Returns the set cache Translator
getCacheId() Get the cache identifier for a specific textDomain and locale. Translator
getEventManager() Get the event manager. Translator
getFallbackLocale() Get the fallback locale. Translator
getLocale() Get the default locale. Translator
getPluginManager() Retrieve the plugin manager for translation loaders. Translator
isEventManagerEnabled() Check whether the event manager is enabled. Translator
setCache() Sets a cache Translator
setEventManager() Set the event manager instance used by this translator. Translator
setFallbackLocale() Set the fallback locale. Translator
setLocale() Set the default locale. Translator
setPluginManager() Set the plugin manager for translation loaders Translator
translate() Translate a message. Translator
translatePlural() Translate a plural message. Translator

Method Details

addRemoteTranslations()

Add remote translations.

Parameter Name Type Description
$type string
$textDomain string

Returns: \Translator

addTranslationFile()

Add a translation file.

Parameter Name Type Description
$type string
$filename string
$textDomain string
$locale string

Returns: \Translator

addTranslationFilePattern()

Add multiple translations with a file pattern.

Parameter Name Type Description
$type string
$baseDir string
$pattern string
$textDomain string

Returns: \Translator

clearCache()

Clears the cache for a specific textDomain and locale.

Parameter Name Type Description
$textDomain string
$locale string

Returns: bool

disableEventManager()

Disable the event manager.

Returns: \Translator

enableEventManager()

Enable the event manager.

Returns: \Translator

factory()

Instantiate a translator

Parameter Name Type Description
$options array|\Traversable

Returns: \Translator

getAllMessages()

Return all the messages.

Parameter Name Type Description
$textDomain string
$locale null

Returns: mixed

getCache()

Returns the set cache

Returns: \CacheStorage The set cache

getCacheId()

Get the cache identifier for a specific textDomain and locale.

Parameter Name Type Description
$textDomain string
$locale string

Returns: string

getEventManager()

Get the event manager.

Returns: \EventManagerInterface|null

getFallbackLocale()

Get the fallback locale.

Returns: string

getLocale()

Get the default locale.

Returns: string

getPluginManager()

Retrieve the plugin manager for translation loaders.

Lazy loads an instance if none currently set.

Returns: \LoaderPluginManager

isEventManagerEnabled()

Check whether the event manager is enabled.

Returns: bool

setCache()

Sets a cache

Parameter Name Type Description
$cache \CacheStorage

Returns: \Translator

setEventManager()

Set the event manager instance used by this translator.

Parameter Name Type Description
$events \EventManagerInterface

Returns: \Translator

setFallbackLocale()

Set the fallback locale.

Parameter Name Type Description
$locale string

Returns: \Translator

setLocale()

Set the default locale.

Parameter Name Type Description
$locale string

Returns: \Translator

setPluginManager()

Set the plugin manager for translation loaders

Parameter Name Type Description
$pluginManager \LoaderPluginManager

Returns: \Translator

translate()

Translate a message.

Parameter Name Type Description
$message string
$textDomain string
$locale string

Returns: string

translatePlural()

Translate a plural message.

Parameter Name Type Description
$singular string
$plural string
$number int
$textDomain string
$locale string|null

Returns: string

Top