class DrupalTranslator implements TranslatorInterface (View source)

Translates strings using Drupal's translation system.

This class is used by the Symfony validator to translate violation messages.

Properties

protected string $locale

The locale used for translating.

Methods

trans($id, array $parameters = [], $domain = NULL, $locale = NULL)

{@inheritdoc}

transChoice($id, $number, array $parameters = [], $domain = NULL, $locale = NULL)

{@inheritdoc}

setLocale($locale)

{@inheritdoc}

getLocale()

{@inheritdoc}

processParameters(array $parameters)

Processes the parameters array for use with TranslatableMarkup.

getOptions($domain = NULL, $locale = NULL)

Returns options suitable for use with TranslatableMarkup.

Details

trans($id, array $parameters = [], $domain = NULL, $locale = NULL)

{@inheritdoc}

Parameters

$id
array $parameters
$domain
$locale

transChoice($id, $number, array $parameters = [], $domain = NULL, $locale = NULL)

{@inheritdoc}

Parameters

$id
$number
array $parameters
$domain
$locale

setLocale($locale)

{@inheritdoc}

Parameters

$locale

getLocale()

{@inheritdoc}

protected processParameters(array $parameters)

Processes the parameters array for use with TranslatableMarkup.

Parameters

array $parameters

protected getOptions($domain = NULL, $locale = NULL)

Returns options suitable for use with TranslatableMarkup.

Parameters

$domain
$locale