You are here

public function LingotekContentTranslationService::getSourceLocale in Lingotek Translation 3.1.x

Same name and namespace in other branches
  1. 8 src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()
  2. 8.2 src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()
  3. 4.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()
  4. 3.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()
  5. 3.2.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()
  6. 3.3.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()
  7. 3.4.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()
  8. 3.5.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()
  9. 3.6.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()
  10. 3.7.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()
  11. 3.8.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()

Gets the translation source locale of a given entity.

Parameters

\Drupal\Core\Entity\ContentEntityInterface &$entity: The entity which we want to get the source locale.

Return value

string The locale as expected by the Lingotek service.

Overrides LingotekContentTranslationServiceInterface::getSourceLocale

1 call to LingotekContentTranslationService::getSourceLocale()
LingotekContentTranslationService::uploadDocument in src/LingotekContentTranslationService.php
Uploads a document to the Lingotek service.

File

src/LingotekContentTranslationService.php, line 465

Class

LingotekContentTranslationService
Service for managing Lingotek content translations.

Namespace

Drupal\lingotek

Code

public function getSourceLocale(ContentEntityInterface &$entity) {
  $source_language = $entity
    ->getUntranslated()
    ->language()
    ->getId();
  return $this->languageLocaleMapper
    ->getLocaleForLangcode($source_language);
}