You are here

public function TranslatableMarkup::render in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php \Drupal\Core\StringTranslation\TranslatableMarkup::render()
  2. 9 core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php \Drupal\Core\StringTranslation\TranslatableMarkup::render()

Renders the object as a string.

Return value

string The translated string.

File

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

Class

TranslatableMarkup
Provides translatable markup class.

Namespace

Drupal\Core\StringTranslation

Code

public function render() {
  if (!isset($this->translatedMarkup)) {
    $this->translatedMarkup = $this
      ->getStringTranslation()
      ->translateString($this);
  }

  // Handle any replacements.
  if ($args = $this
    ->getArguments()) {
    return $this
      ->placeholderFormat($this->translatedMarkup, $args);
  }
  return $this->translatedMarkup;
}