Translator.

category Zend
package Zend_I18n
subpackage Translator

 Methods

Add remote translations.

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

Parameters

$type

string

$textDomain

string

Returns

Add a translation file.

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

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

Parameters

$type

string

$baseDir

string

$pattern

string

$textDomain

string

Returns

Instantiate a translator

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

Parameters

$options

array\Traversable

Exceptions

\Zend\I18n\Exception\InvalidArgumentException

Returns

Returns the set cache

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

Get the fallback locale.

getFallbackLocale() : string

Returns

string

Get the default locale.

getLocale() : string

Returns

string

Retrieve the plugin manager for translation loaders.

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

Lazy loads an instance if none currently set.

Returns

Sets a cache

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

Set the fallback locale.

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

Parameters

$locale

string

Returns

Set the default locale.

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

Parameters

$locale

string

Returns

Set the plugin manager for translation loaders

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

Translate a message.

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

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

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

Parameters

$message

string

$locale

string

$textDomain

string

Returns

stringnull

Load messages for a given language and domain.

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

Parameters

$textDomain

string

$locale

string

Exceptions

\Zend\I18n\Exception\RuntimeException

 Properties

 

Translation cache.

$cache : \Zend\Cache\Storage\StorageInterface

 

Locale to use as fallback if there is no translation.

$fallbackLocale : string

 

Files used for loading messages.

$files : array

 

Default locale.

$locale : string

 

Messages loaded by the translator.

$messages : array

 

Patterns used for loading messages.

$patterns : array

 

Plugin manager for translation loaders.

$pluginManager : \Zend\I18n\Translator\LoaderPluginManager

 

Remote locations for loading messages.

$remote : array