TranslatorInterface.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace Drupal\Core\Validation;
  3. /**
  4. * Defines an interface used in validation.
  5. *
  6. * This replaces the interface used by the Symfony validator in order
  7. * to indicate that the Drupal code is actually independent from the
  8. * Symfony translation component.
  9. *
  10. * @see https://github.com/symfony/symfony/pull/6189
  11. * @see https://github.com/symfony/symfony/issues/15714
  12. */
  13. interface TranslatorInterface {
  14. /**
  15. * Translates the given message.
  16. *
  17. * @param string $id
  18. * The message id (may also be an object that can be cast to string).
  19. * @param array $parameters
  20. * An array of parameters for the message.
  21. * @param string|null $domain
  22. * The domain for the message or null to use the default.
  23. * @param string|null $locale
  24. * The locale or null to use the default.
  25. *
  26. * @return string
  27. * The translated string.
  28. *
  29. * @throws InvalidArgumentException
  30. * If the locale contains invalid characters.
  31. */
  32. public function trans($id, array $parameters = [], $domain = NULL, $locale = NULL);
  33. }