function StringTranslationTrait::getStringTranslation

Same name in other branches
  1. 9 core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php \Drupal\Core\StringTranslation\StringTranslationTrait::getStringTranslation()
  2. 10 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.

12 calls to StringTranslationTrait::getStringTranslation()
ConfigSingleImportForm::validateForm in core/modules/config/src/Form/ConfigSingleImportForm.php
Form validation handler.
ConfigSync::submitForm in core/modules/config/src/Form/ConfigSync.php
Form submission handler.
EntityType::getBundleLabel in core/lib/Drupal/Core/Entity/EntityType.php
Gets the label for the bundle.
EntityType::getCollectionLabel in core/lib/Drupal/Core/Entity/EntityType.php
Gets the uppercase plural form of the name of the entity type.
EntityType::getPluralLabel in core/lib/Drupal/Core/Entity/EntityType.php
Gets the indefinite plural form of the name of the entity type.

... 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.