public function TranslatableInterface::getTranslation

Gets a translation of the data.

The returned translation has to be implement the same typed data interfaces as this typed data object, excluding the TranslatableInterface. E.g., if this typed data object implements the ComplexDataInterface and AccessibleInterface, the translation object has to implement both as well.

Parameters

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

$strict: (optional) If the data is complex, whether the translation should include only translatable properties. If set to FALSE, untranslatable properties are included (in default language) as well as translatable properties in the specified language. Defaults to TRUE.

Return value

\Drupal\Core\TypedData\TypedDataInterface A typed data object for the translated data.

2 methods override TranslatableInterface::getTranslation()
Entity::getTranslation in drupal/core/lib/Drupal/Core/Entity/Entity.php
Implements TranslatableInterface::getTranslation().
ViewUI::getTranslation in drupal/core/modules/views/views_ui/lib/Drupal/views_ui/ViewUI.php
Implements \Drupal\Core\TypedData\TranslatableInterface::getTranslation().

File

drupal/core/lib/Drupal/Core/TypedData/TranslatableInterface.php, line 54
Definition of Drupal\Core\TypedData\TranslatableInterface.

Class

TranslatableInterface
Interface for translatable data.

Namespace

Drupal\Core\TypedData

Code

public function getTranslation($langcode, $strict = TRUE);