Zend Framework
3.0
|
Public Member Functions | |
setLocale ($locale) | |
Set the default locale. | |
getLocale () | |
Get the default locale. | |
setFallbackLocale ($locale) | |
Set the fallback locale. | |
getFallbackLocale () | |
Get the fallback locale. | |
setCache (CacheStorage $cache=null) | |
Sets a cache. | |
getCache () | |
Returns the set cache. | |
setPluginManager (LoaderPluginManager $pluginManager) | |
Set the plugin manager for translation loaders. | |
getPluginManager () | |
Retrieve the plugin manager for translation loaders. | |
translate ($message, $textDomain= 'default', $locale=null) | |
Translate a message. | |
translatePlural ($singular, $plural, $number, $textDomain= 'default', $locale=null) | |
Translate a plural message. | |
addTranslationFile ($type, $filename, $textDomain= 'default', $locale=null) | |
Add a translation file. | |
addTranslationFilePattern ($type, $baseDir, $pattern, $textDomain= 'default') | |
Add multiple translations with a file pattern. | |
addRemoteTranslations ($type, $textDomain= 'default') | |
Add remote translations. | |
getAllMessages ($textDomain= 'default', $locale=null) | |
Return all the messages. | |
getEventManager () | |
Get the event manager. | |
setEventManager (EventManagerInterface $events) | |
Set the event manager instance used by this translator. | |
isEventManagerEnabled () | |
Check whether the event manager is enabled. | |
enableEventManager () | |
Enable the event manager. | |
disableEventManager () | |
Disable the event manager. | |
Static Public Member Functions | |
static | factory ($options) |
Instantiate a translator. | |
Public Attributes | |
const | EVENT_MISSING_TRANSLATION = 'missingTranslation' |
Event fired when the translation for a message is missing. | |
const | EVENT_NO_MESSAGES_LOADED = 'noMessagesLoaded' |
Event fired when no messages were loaded for a locale/text-domain combination. | |
Protected Member Functions | |
getTranslatedMessage ($message, $locale, $textDomain= 'default') | |
Get a translated message. | |
loadMessages ($textDomain, $locale) | |
Load messages for a given language and domain. | |
loadMessagesFromRemote ($textDomain, $locale) | |
Load messages from remote sources. | |
loadMessagesFromPatterns ($textDomain, $locale) | |
Load messages from patterns. | |
loadMessagesFromFiles ($textDomain, $locale) | |
Load messages from files. | |
Protected Attributes | |
$messages = [] | |
$files = [] | |
$patterns = [] | |
$remote = [] | |
$locale | |
$fallbackLocale | |
$cache | |
$pluginManager | |
$events | |
$eventsEnabled = false | |
addRemoteTranslations | ( | $type, | |
$textDomain = 'default' |
|||
) |
addTranslationFile | ( | $type, | |
$filename, | |||
$textDomain = 'default' , |
|||
$locale = null |
|||
) |
Add a translation file.
string | $type | |
string | $filename | |
string | $textDomain | |
string | $locale |
addTranslationFilePattern | ( | $type, | |
$baseDir, | |||
$pattern, | |||
$textDomain = 'default' |
|||
) |
Add multiple translations with a file pattern.
string | $type | |
string | $baseDir | |
string | $pattern | |
string | $textDomain |
disableEventManager | ( | ) |
Disable the event manager.
enableEventManager | ( | ) |
Enable the event manager.
|
static |
Instantiate a translator.
array | Traversable | $options |
Exception\InvalidArgumentException |
getAllMessages | ( | $textDomain = 'default' , |
|
$locale = null |
|||
) |
Return all the messages.
string | $textDomain | |
null | $locale |
getCache | ( | ) |
Returns the set cache.
getEventManager | ( | ) |
Get the event manager.
getFallbackLocale | ( | ) |
Get the fallback locale.
getLocale | ( | ) |
Get the default locale.
Exception\ExtensionNotLoadedException | if ext/intl is not present and no locale set |
getPluginManager | ( | ) |
Retrieve the plugin manager for translation loaders.
Lazy loads an instance if none currently set.
|
protected |
Get a translated message.
getTranslatedMessage.missing-translation
string | $message | |
string | $locale | |
string | $textDomain |
isEventManagerEnabled | ( | ) |
Check whether the event manager is enabled.
|
protected |
Load messages for a given language and domain.
loadMessages.no-messages-loaded
string | $textDomain | |
string | $locale |
Exception\RuntimeException |
|
protected |
Load messages from files.
string | $textDomain | |
string | $locale |
Exception\RuntimeException | When specified loader is not a file loader |
|
protected |
Load messages from patterns.
string | $textDomain | |
string | $locale |
Exception\RuntimeException | When specified loader is not a file loader |
|
protected |
Load messages from remote sources.
string | $textDomain | |
string | $locale |
Exception\RuntimeException | When specified loader is not a remote loader |
setCache | ( | CacheStorage | $cache = null | ) |
setEventManager | ( | EventManagerInterface | $events | ) |
Set the event manager instance used by this translator.
EventManagerInterface | $events |
setFallbackLocale | ( | $locale | ) |
setLocale | ( | $locale | ) |
setPluginManager | ( | LoaderPluginManager | $pluginManager | ) |
Set the plugin manager for translation loaders.
LoaderPluginManager | $pluginManager |
translate | ( | $message, | |
$textDomain = 'default' , |
|||
$locale = null |
|||
) |
Translate a message.
string | $message | |
string | $textDomain | |
string | $locale |
Implements TranslatorInterface.
translatePlural | ( | $singular, | |
$plural, | |||
$number, | |||
$textDomain = 'default' , |
|||
$locale = null |
|||
) |
Translate a plural message.
string | $singular | |
string | $plural | |
int | $number | |
string | $textDomain | |
string | null | $locale |
Exception\OutOfBoundsException |
Implements TranslatorInterface.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
const EVENT_MISSING_TRANSLATION = 'missingTranslation' |
Event fired when the translation for a message is missing.
const EVENT_NO_MESSAGES_LOADED = 'noMessagesLoaded' |
Event fired when no messages were loaded for a locale/text-domain combination.