Translator
class Translator implements TranslatorInterface, TranslatorInterface, TranslatorBagInterface
Properties
protected MessageCatalogueInterface[] | $catalogues |
Methods
No description
Adds a Resource.
Sets the current locale.
Returns the current locale.
Sets the fallback locales.
Gets the fallback locales.
Translates the given message.
Translates the given choice message by choosing a translation according to a number.
Gets the catalogue by locale.
Gets the loaders.
No description
No description
No description
Asserts that the locale is valid, throws an Exception if not.
Details
__construct(string|null $locale, MessageFormatterInterface $formatter = null, string $cacheDir = null, bool $debug = false)
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.