8.2.x StringTranslationTrait.php protected StringTranslationTrait::getStringTranslation()
8.0.x StringTranslationTrait.php protected StringTranslationTrait::getStringTranslation()
8.1.x StringTranslationTrait.php protected StringTranslationTrait::getStringTranslation()
8.3.x StringTranslationTrait.php protected StringTranslationTrait::getStringTranslation()

Gets the string translation service.

Return value

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

9 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::getPluralLabel in core/lib/Drupal/Core/Entity/EntityType.php
Gets the plural label of the entity type.
ModulesListConfirmForm::submitForm in core/modules/system/src/Form/ModulesListConfirmForm.php
Form submission handler.
ModulesListForm::submitForm in core/modules/system/src/Form/ModulesListForm.php
Form submission handler.

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