diff --git a/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php b/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php index dcd1e59..9ae41ea 100644 --- a/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php +++ b/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php @@ -10,12 +10,13 @@ /** * Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface. * - * The supported way to work with injected translation in Drupal 8 so that the - * string extractor can find strings is by using a protected t() method wrapping - * \Drupal\Core\StringTranslation\TranslationInterface::translate(). This trait - * provides this method in a re-usable way. - * Procedural code should use t(). Any other way will result to untranslatable - * strings since the string extractor will not be able to find them. + * Injected translation can be performed by using a protected method ::t(), so + * string extractor tools can find all translatable strings. This method must wrap + * \Drupal\Core\StringTranslation\TranslationInterface::translate(). + * This trait provides this method in a re-usable way. + * Procedural code must use the global function t(). Any other approach will + * result in untranslatable strings, because the string extractor will not be + * able to find them. */ trait StringTranslationTrait { diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/StringTranslationTraitTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/StringTranslationTraitTest.php index 10bcafb..4c7eb33 100644 --- a/core/tests/Drupal/Tests/Core/StringTranslation/StringTranslationTraitTest.php +++ b/core/tests/Drupal/Tests/Core/StringTranslation/StringTranslationTraitTest.php @@ -10,9 +10,10 @@ use Drupal\Tests\UnitTestCase; /** - * Tests the string translation trait. + * Tests \Drupal\Core\StringTranslation\StringTranslationTrait. * * @see \Drupal\Core\StringTranslation\StringTranslationTrait + * @coversDefaultClass \Drupal\Core\StringTranslation\StringTranslationTrait * * @group Drupal * @group StringTranslation @@ -39,8 +40,7 @@ class StringTranslationTraitTest extends UnitTestCase { */ public static function getInfo() { return array( - 'name' => 'String translation trait', - 'description' => 'Tests the string translation trait.', + 'name' => '\Drupal\Core\StringTranslation\StringTranslationTrait unit test', 'group' => 'StringTranslation', ); } @@ -55,7 +55,7 @@ public function setUp() { } /** - * Tests \Drupal\Core\StringTranslation\StringTranslationTrait::t() + * @covers ::t */ public function testT() { $method = $this->reflection->getMethod('t'); @@ -65,7 +65,7 @@ public function testT() { } /** - * Tests \Drupal\Core\StringTranslation\StringTranslationTrait::formatPlural() + * @covers ::formatPlural */ public function testFormatPlural() { $method = $this->reflection->getMethod('formatPlural');