public function LingotekContentTranslationService::getSourceLocale in Lingotek Translation 3.8.x
Same name and namespace in other branches
- 8 src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()
- 8.2 src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()
- 4.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()
- 3.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()
- 3.1.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()
- 3.2.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()
- 3.3.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()
- 3.4.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()
- 3.5.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()
- 3.6.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceLocale()
- 3.7.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 571
Class
- LingotekContentTranslationService
- Service for managing Lingotek content translations.
Namespace
Drupal\lingotekCode
public function getSourceLocale(ContentEntityInterface &$entity) {
$source_language = $entity
->getUntranslated()
->language()
->getId();
return $this->languageLocaleMapper
->getLocaleForLangcode($source_language);
}