TranslatableMarkup

Provides translatable markup class.

This object, when cast to a string, will return the formatted, translated string. Avoid casting it to a string yourself, because it is preferable to let the rendering system do the cast as late as possible in the rendering process, so that this object itself can be put, untranslated, into render caches and thus the cache can be shared between different language contexts.

Hierarchy

See also

\Drupal\Component\Render\FormattableMarkup

\Drupal\Core\StringTranslation\TranslationManager::translateString()

\Drupal\Core\Annotation\Translation

File

core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php, line 22

Namespace

Drupal\Core\StringTranslation

Members

Name Modifiers Type Description
FormattableMarkup::$arguments protected property The arguments to replace placeholders with.
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::$string protected property The string to be translated.
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
TranslatableMarkup::__construct public function Constructs a new class instance. Overrides FormattableMarkup::__construct
TranslatableMarkup::__sleep public function Magic __sleep() method to avoid serializing the string translator.
doc_Drupal
2016-10-29 09:49:03
Comments
Leave a Comment

Please login to continue.