You are here

public function TranslatorInterface::trans in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Validation/TranslatorInterface.php \Drupal\Core\Validation\TranslatorInterface::trans()
  2. 9 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.

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);