function StringTranslationTrait::getStringTranslation

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

Gets the string translation service.

Return value

\Drupal\Core\StringTranslation\TranslationInterface The string translation service.

11 calls to StringTranslationTrait::getStringTranslation()
ConfigSingleImportForm::validateForm in core/modules/config/src/Form/ConfigSingleImportForm.php
ConfigSync::submitForm in core/modules/config/src/Form/ConfigSync.php
EntityType::getBundleLabel in core/lib/Drupal/Core/Entity/EntityType.php
EntityType::getCollectionLabel in core/lib/Drupal/Core/Entity/EntityType.php
EntityType::getPluralLabel in core/lib/Drupal/Core/Entity/EntityType.php

... See full list

File

core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php, line 102

Class

StringTranslationTrait
Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.

Namespace

Drupal\Core\StringTranslation

Code

protected function getStringTranslation() {
    if (!$this->stringTranslation) {
        $this->stringTranslation = \Drupal::service('string_translation');
    }
    return $this->stringTranslation;
}

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