You are here

public function TranslatableInterface::getTranslation in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/TypedData/TranslatableInterface.php \Drupal\Core\TypedData\TranslatableInterface::getTranslation()
  2. 10 core/lib/Drupal/Core/TypedData/TranslatableInterface.php \Drupal\Core\TypedData\TranslatableInterface::getTranslation()

Gets a translation of the data.

The returned translation has to be of the same type than this typed data object.

Parameters

$langcode: The language code of the translation to get or LanguageInterface::LANGCODE_DEFAULT to get the data in default language.

Return value

$this A typed data object for the translated data.

Throws

\InvalidArgumentException If an invalid or non-existing translation language is specified.

1 method overrides TranslatableInterface::getTranslation()
ContentEntityBase::getTranslation in core/lib/Drupal/Core/Entity/ContentEntityBase.php
Gets a translation of the data.

File

core/lib/Drupal/Core/TypedData/TranslatableInterface.php, line 78

Class

TranslatableInterface
Interface for translatable data.

Namespace

Drupal\Core\TypedData

Code

public function getTranslation($langcode);