function StaticTranslation::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/StringTranslation/Translator/StaticTranslation.php \Drupal\Core\StringTranslation\Translator\StaticTranslation::__construct()
  2. 8.9.x core/lib/Drupal/Core/StringTranslation/Translator/StaticTranslation.php \Drupal\Core\StringTranslation\Translator\StaticTranslation::__construct()
  3. 11.x core/lib/Drupal/Core/StringTranslation/Translator/StaticTranslation.php \Drupal\Core\StringTranslation\Translator\StaticTranslation::__construct()

Constructs a translator from an array of translations.

Parameters

array $translations: Array of override strings indexed by language and context

2 calls to StaticTranslation::__construct()
CustomStrings::__construct in core/lib/Drupal/Core/StringTranslation/Translator/CustomStrings.php
Constructs a CustomStrings object.
FileTranslation::__construct in core/lib/Drupal/Core/StringTranslation/Translator/FileTranslation.php
Constructs a StaticTranslation object.
2 methods override StaticTranslation::__construct()
CustomStrings::__construct in core/lib/Drupal/Core/StringTranslation/Translator/CustomStrings.php
Constructs a CustomStrings object.
FileTranslation::__construct in core/lib/Drupal/Core/StringTranslation/Translator/FileTranslation.php
Constructs a StaticTranslation object.

File

core/lib/Drupal/Core/StringTranslation/Translator/StaticTranslation.php, line 26

Class

StaticTranslation
String translator with a static cache for translations.

Namespace

Drupal\Core\StringTranslation\Translator

Code

public function __construct($translations = []) {
    $this->translations = $translations;
}

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