public function LingotekContentTranslationService::checkTargetStatuses in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::checkTargetStatuses()
- 4.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::checkTargetStatuses()
- 3.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::checkTargetStatuses()
- 3.1.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::checkTargetStatuses()
- 3.2.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::checkTargetStatuses()
- 3.3.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::checkTargetStatuses()
- 3.4.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::checkTargetStatuses()
- 3.5.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::checkTargetStatuses()
- 3.6.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::checkTargetStatuses()
- 3.7.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::checkTargetStatuses()
- 3.8.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::checkTargetStatuses()
Gets the current status of all the target translations.
Parameters
ContentEntityInterface &$entity: The entity which status we want to check.
Overrides LingotekContentTranslationServiceInterface::checkTargetStatuses
File
- src/
LingotekContentTranslationService.php, line 160 - Contains \Drupal\lingotek\LingotekContentTranslationService.
Class
- LingotekContentTranslationService
- Service for managing Lingotek content translations.
Namespace
Drupal\lingotekCode
public function checkTargetStatuses(ContentEntityInterface &$entity) {
$document_id = $this
->getDocumentId($entity);
$translation_statuses = $this->lingotek
->getDocumentTranslationStatuses($document_id);
foreach ($translation_statuses as $lingotek_locale => $progress) {
$drupal_language = $this->languageLocaleMapper
->getConfigurableLanguageForLocale($lingotek_locale);
if ($drupal_language == NULL) {
continue;
// languages existing in TMS, but not configured on Drupal
}
$langcode = $drupal_language
->id();
$current_target_status = $this
->getTargetStatus($entity, $langcode);
if (in_array($current_target_status, [
Lingotek::STATUS_UNTRACKED,
Lingotek::STATUS_EDITED,
Lingotek::STATUS_REQUEST,
Lingotek::STATUS_NONE,
Lingotek::STATUS_READY,
Lingotek::STATUS_PENDING,
NULL,
])) {
if ($progress === Lingotek::PROGRESS_COMPLETE) {
$this
->setTargetStatus($entity, $langcode, Lingotek::STATUS_READY);
}
else {
$this
->setTargetStatus($entity, $langcode, Lingotek::STATUS_PENDING);
}
}
}
}