class TestTranslationManager

Same name in this branch
  1. 9 core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php \Drupal\Tests\Core\StringTranslation\TestTranslationManager
Same name 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

Title Sort descending Modifiers Object type Summary Overriden Title
TestTranslationManager::formatPlural public function Formats a string containing a count of items. Overrides TranslationInterface::formatPlural
TestTranslationManager::translate public function Translates a string to the current language or to a given language. Overrides TranslationInterface::translate
TestTranslationManager::translateString public function Translates a TranslatableMarkup object to a string. Overrides TranslationInterface::translateString

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