You are here

protected function DrupalTranslator::getOptions in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Validation/DrupalTranslator.php \Drupal\Core\Validation\DrupalTranslator::getOptions()
  2. 9 core/lib/Drupal/Core/Validation/DrupalTranslator.php \Drupal\Core\Validation\DrupalTranslator::getOptions()

Returns options suitable for use with TranslatableMarkup.

File

core/lib/Drupal/Core/Validation/DrupalTranslator.php, line 104

Class

DrupalTranslator
Translates strings using Drupal's translation system.

Namespace

Drupal\Core\Validation

Code

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

  // We do not support domains, so we ignore this parameter.
  // If locale is left NULL, TranslatableMarkup will default to the interface
  // language.
  $locale = $locale ?? $this->locale;
  return [
    'langcode' => $locale,
  ];
}