Translator
class Translator extends Translator implements WarmableInterface
Translator.
Properties
protected MessageCatalogueInterface[] | $catalogues | from Translator | |
protected | $container | ||
protected | $loaderIds | ||
protected | $options |
Methods
Constructor.
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.
No description
Asserts that the locale is valid, throws an Exception if not.
Warms up the cache.
No description
Details
__construct(ContainerInterface $container, MessageFormatterInterface $formatter, string $defaultLocale, 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.
addResource(string $format, mixed $resource, string $locale, string $domain = null)
Adds a Resource.
string
trans(string $id, array $parameters = array(), string|null $domain = null, string|null $locale = null)
Translates the given message.
string
transChoice(string $id, int $number, array $parameters = array(), string|null $domain = null, string|null $locale = null)
deprecated
deprecated since Symfony 4.2, use the trans() method instead with a %count% parameter
Translates the given choice message by choosing a translation according to a number.