public function Translation::__construct

Constructs a Translation object.

Parses values passed into this class through the t() function in Drupal and handles an optional context for the string.

File

drupal/core/lib/Drupal/Core/Annotation/Translation.php, line 61
Definition of Drupal\Core\Annotation\Translation.

Class

Translation
Defines a translatable annotation object.

Namespace

Drupal\Core\Annotation

Code

public function __construct($values) {
  $string = $values['value'];
  $options = array();
  if (!empty($values['context'])) {
    $options = array(
      'context' => $values['context'],
    );
  }
  $this->translation = t($string, array(), $options);
}