function TranslatorInterface::trans

Same name in other branches
  1. 9 core/lib/Drupal/Core/Validation/TranslatorInterface.php \Drupal\Core\Validation\TranslatorInterface::trans()
  2. 8.9.x core/lib/Drupal/Core/Validation/TranslatorInterface.php \Drupal\Core\Validation\TranslatorInterface::trans()
  3. 11.x core/lib/Drupal/Core/Validation/TranslatorInterface.php \Drupal\Core\Validation\TranslatorInterface::trans()

Translates the given message.

Parameters

string $id: The message id (may also be an object that can be cast to string).

array $parameters: An array of parameters for the message.

string|null $domain: The domain for the message or null to use the default.

string|null $locale: The locale or null to use the default.

Return value

string The translated string.

Throws

\InvalidArgumentException If the locale contains invalid characters.

1 method overrides TranslatorInterface::trans()
DrupalTranslator::trans in core/lib/Drupal/Core/Validation/DrupalTranslator.php
Translates the given message.

File

core/lib/Drupal/Core/Validation/TranslatorInterface.php, line 35

Class

TranslatorInterface
Defines an interface used in validation.

Namespace

Drupal\Core\Validation

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.