Translator

class Translator extends Translator implements WarmableInterface

Translator.

Methods

__construct(ContainerInterface $container, MessageFormatterInterface $formatter, string $defaultLocale, array $loaderIds = array(), array $options = array())

Constructor.

warmUp(string $cacheDir)

Warms up the cache.

addResource($format, $resource, $locale, $domain = null)

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.

Parameters

ContainerInterface $container A ContainerInterface instance
MessageFormatterInterface $formatter The message formatter
string $defaultLocale
array $loaderIds An array of loader Ids
array $options An array of options

Exceptions

InvalidArgumentException

warmUp(string $cacheDir)

Warms up the cache.

Parameters

string $cacheDir The cache directory

addResource($format, $resource, $locale, $domain = null)

Parameters

$format
$resource
$locale
$domain

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/4.0/Symfony/Bundle/FrameworkBundle/Translation/Translator.html