function DrupalTranslator::getOptions

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

Returns options suitable for use with TranslatableMarkup.

2 calls to DrupalTranslator::getOptions()
DrupalTranslator::trans in core/lib/Drupal/Core/Validation/DrupalTranslator.php
Translates the given message.
DrupalTranslator::transChoice in core/lib/Drupal/Core/Validation/DrupalTranslator.php

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,
    ];
}

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