You are here

public function StaticTranslation::__construct in Drupal 9

Same name and namespace in other branches
  1. 8 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;
}