function StringTranslationTrait::getStringTranslation

Same name and namespace 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. 10 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
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 <a href="/api/drupal/core%21lib%21Drupal%21Core%21StringTranslation%21TranslationInterface.php/interface/TranslationInterface/11.x" title="Interface for the translation.manager translation service." class="local">\Drupal\Core\StringTranslation\TranslationInterface</a>.

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.