function DrupalTranslator::trans
Same name in other branches
- 9 core/lib/Drupal/Core/Validation/DrupalTranslator.php \Drupal\Core\Validation\DrupalTranslator::trans()
- 8.9.x core/lib/Drupal/Core/Validation/DrupalTranslator.php \Drupal\Core\Validation\DrupalTranslator::trans()
- 10 core/lib/Drupal/Core/Validation/DrupalTranslator.php \Drupal\Core\Validation\DrupalTranslator::trans()
Overrides TranslatorInterface::trans
File
-
core/
lib/ Drupal/ Core/ Validation/ DrupalTranslator.php, line 25
Class
- DrupalTranslator
- Translates strings using Drupal's translation system.
Namespace
Drupal\Core\ValidationCode
public function trans($id, array $parameters = [], $domain = NULL, $locale = NULL) {
// If a TranslatableMarkup object is passed in as $id, return it since the
// message has already been translated.
if ($id instanceof TranslatableMarkup) {
return $id;
}
return new TranslatableMarkup($id, $this->processParameters($parameters), $this->getOptions($domain, $locale));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.