class TestTranslationManager

Same name in this branch
  1. 9 core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php \Drupal\Tests\Core\StringTranslation\TestTranslationManager
Same name and namespace in other branches
  1. 8.9.x core/modules/user/tests/src/Unit/PermissionHandlerTest.php \Drupal\Tests\user\Unit\TestTranslationManager
  2. 8.9.x core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php \Drupal\Tests\Core\StringTranslation\TestTranslationManager
  3. 10 core/modules/user/tests/src/Unit/PermissionHandlerTest.php \Drupal\Tests\user\Unit\TestTranslationManager
  4. 10 core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php \Drupal\Tests\Core\StringTranslation\TestTranslationManager
  5. 11.x core/modules/user/tests/src/Unit/PermissionHandlerTest.php \Drupal\Tests\user\Unit\TestTranslationManager
  6. 11.x core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php \Drupal\Tests\Core\StringTranslation\TestTranslationManager

Implements a translation manager in tests.

Hierarchy

Expanded class hierarchy of TestTranslationManager

File

core/modules/user/tests/src/Unit/PermissionHandlerTest.php, line 379

Namespace

Drupal\Tests\user\Unit
View source
class TestTranslationManager implements TranslationInterface {
    
    /**
     * {@inheritdoc}
     */
    public function translate($string, array $args = [], array $options = []) {
        return new TranslatableMarkup($string, $args, $options, $this);
    }
    
    /**
     * {@inheritdoc}
     */
    public function translateString(TranslatableMarkup $translated_string) {
        return $translated_string->getUntranslatedString();
    }
    
    /**
     * {@inheritdoc}
     */
    public function formatPlural($count, $singular, $plural, array $args = [], array $options = []) {
        return new PluralTranslatableMarkup($count, $singular, $plural, $args, $options, $this);
    }

}

Members


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