class TranslationWrapper

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/StringTranslation/TranslationWrapper.php \Drupal\Core\StringTranslation\TranslationWrapper
  2. 10 core/lib/Drupal/Core/StringTranslation/TranslationWrapper.php \Drupal\Core\StringTranslation\TranslationWrapper
  3. 11.x core/lib/Drupal/Core/StringTranslation/TranslationWrapper.php \Drupal\Core\StringTranslation\TranslationWrapper

Provides translatable string class.

Hierarchy

Expanded class hierarchy of TranslationWrapper

Deprecated

in drupal:8.0.0 and is removed from drupal:11.0.0. Use the \Drupal\Core\StringTranslation\TranslatableMarkup class instead.

See also

https://www.drupal.org/node/2571255

1 file declares its use of TranslationWrapper
TranslationWrapperTest.php in core/tests/Drupal/Tests/Core/StringTranslation/TranslationWrapperTest.php

File

core/lib/Drupal/Core/StringTranslation/TranslationWrapper.php, line 13

Namespace

Drupal\Core\StringTranslation
View source
class TranslationWrapper extends TranslatableMarkup {
    
    /**
     * {@inheritdoc}
     */
    public function __construct($string, array $arguments = [], array $options = [], TranslationInterface $string_translation = NULL) {
        @trigger_error(__CLASS__ . ' is deprecated in drupal:8.0.0 and is removed from drupal:11.0.0. Use the \\Drupal\\Core\\StringTranslation\\TranslatableMarkup class instead. See https://www.drupal.org/node/2571255', E_USER_DEPRECATED);
        parent::__construct($string, $arguments, $options, $string_translation);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
FormattableMarkup::$arguments protected property The arguments to replace placeholders with.
FormattableMarkup::$string protected property The string containing placeholders.
FormattableMarkup::jsonSerialize public function Returns a representation of the object for use in JSON serialization.
FormattableMarkup::placeholderEscape protected static function Escapes a placeholder replacement value if needed.
FormattableMarkup::placeholderFormat protected static function Replaces placeholders in a string with values.
ToStringTrait::_die protected function For test purposes, wrap die() in an overridable method.
ToStringTrait::__toString public function Implements the magic __toString() method.
TranslatableMarkup::$options protected property The translation options.
TranslatableMarkup::$stringTranslation protected property The string translation service.
TranslatableMarkup::$translatedMarkup protected property The translated markup without placeholder replacements.
TranslatableMarkup::count public function Returns the string length. Overrides FormattableMarkup::count
TranslatableMarkup::getArguments public function Gets all arguments from this translated string.
TranslatableMarkup::getOption public function Gets a specific option from this translated string.
TranslatableMarkup::getOptions public function Gets all options from this translated string.
TranslatableMarkup::getStringTranslation protected function Gets the string translation service.
TranslatableMarkup::getUntranslatedString public function Gets the untranslated string value stored in this translated string.
TranslatableMarkup::render public function Renders the object as a string. Overrides ToStringTrait::render 1
TranslatableMarkup::__sleep public function Magic __sleep() method to avoid serializing the string translator. 1
TranslationWrapper::__construct public function Constructs a new class instance. Overrides TranslatableMarkup::__construct

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