function Drupal::translation

Same name in other branches
  1. 9 core/lib/Drupal.php \Drupal::translation()
  2. 10 core/lib/Drupal.php \Drupal::translation()
  3. 11.x core/lib/Drupal.php \Drupal::translation()

Returns the string translation service.

Return value

\Drupal\Core\StringTranslation\TranslationManager The string translation manager.

5 calls to Drupal::translation()
DeleteActionTest::testGetDerivativeDefinitions in core/tests/Drupal/KernelTests/Core/Action/DeleteActionTest.php
@covers \Drupal\Core\Action\Plugin\Action\Derivative\EntityDeleteActionDeriver::getDerivativeDefinitions
DrupalTest::testTranslation in core/tests/Drupal/Tests/Core/DrupalTest.php
Tests the translation() method.
PublishActionTest::testGetDerivativeDefinitions in core/tests/Drupal/KernelTests/Core/Action/PublishActionTest.php
@covers \Drupal\Core\Action\Plugin\Action\Derivative\EntityPublishedActionDeriver::getDerivativeDefinitions
SaveActionTest::testGetDerivativeDefinitions in core/tests/Drupal/KernelTests/Core/Action/SaveActionTest.php
@covers \Drupal\Core\Action\Plugin\Action\Derivative\EntityChangedActionDeriver::getDerivativeDefinitions
_simpletest_build_summary_line in core/modules/simpletest/simpletest.module
Formats each test result type pluralized summary.

File

core/lib/Drupal.php, line 636

Class

Drupal
Static Service Container wrapper.

Code

public static function translation() {
    return static::getContainer()->get('string_translation');
}

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