Translator
class Translator extends Translator implements WarmableInterface
Translator.
Methods
Constructor.
Sets the ConfigCache factory to use.
Adds a Resource.
Translates the given message.
Translates the given choice message by choosing a translation according to a number.
Gets the catalogue by locale.
This method is public because it needs to be callable from a closure in PHP 5.3. It should be made protected (or even private, if possible) in 3.0.
Warms up the cache.
Details
at line line 56
__construct(ContainerInterface $container, MessageSelector $selector, array $loaderIds = array(), array $options = array())
Constructor.
Available options:
- cache_dir: The cache directory (or null to disable caching)
- debug: Whether to enable debugging or not (false by default)
- resource_files: List of translation resources available grouped by locale.
in Translator at line line 95
setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory)
Sets the ConfigCache factory to use.
in Translator at line line 106
addLoader(string $format, LoaderInterface $loader)
Adds a Loader.
in Translator at line line 121
addResource(string $format, mixed $resource, string $locale, string $domain = null)
Adds a Resource.
in Translator at line line 141
setLocale(string $locale)
Sets the current locale.
in Translator at line line 150
string
getLocale()
Returns the current locale.
in Translator at line line 164
setFallbackLocale(string|array $locales)
deprecated
deprecated
Sets the fallback locale(s).
in Translator at line line 178
setFallbackLocales(array $locales)
Sets the fallback locales.
in Translator at line line 195
array
getFallbackLocales()
Gets the fallback locales.
in Translator at line line 203
string
trans(string $id, array $parameters = array(), string|null $domain = null, string|null $locale = null)
Translates the given message.
in Translator at line line 215
string
transChoice(string $id, int $number, array $parameters = array(), string|null $domain = null, string|null $locale = null)
Translates the given choice message by choosing a translation according to a number.
in Translator at line line 239
MessageCatalogueInterface
getCatalogue(string|null $locale = null)
Gets the catalogue by locale.
in Translator at line line 273
array[array]
getMessages(string|null $locale = null)
deprecated
deprecated
Collects all messages for the given locale.
in Translator at line line 347
dumpCatalogue($locale, ConfigCacheInterface $cache)
This method is public because it needs to be callable from a closure in PHP 5.3. It should be made protected (or even private, if possible) in 3.0.
at line line 78
warmUp(string $cacheDir)
Warms up the cache.