public function LingotekConfigTranslationService::checkConfigTargetStatus in Lingotek Translation 3.2.x
Same name and namespace in other branches
- 8 src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkConfigTargetStatus()
- 8.2 src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkConfigTargetStatus()
- 4.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkConfigTargetStatus()
- 3.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkConfigTargetStatus()
- 3.1.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkConfigTargetStatus()
- 3.3.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkConfigTargetStatus()
- 3.4.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkConfigTargetStatus()
- 3.5.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkConfigTargetStatus()
- 3.6.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkConfigTargetStatus()
- 3.7.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkConfigTargetStatus()
- 3.8.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkConfigTargetStatus()
Checks the status of the translation in the Lingotek service.
Parameters
string $mapper_id: The entity which status we want to check.
string $locale: Lingotek translation language which we want to check.
Return value
bool True if the entity is available for download.
Overrides LingotekConfigTranslationServiceInterface::checkConfigTargetStatus
File
- src/
LingotekConfigTranslationService.php, line 1254
Class
- LingotekConfigTranslationService
- Service for managing Lingotek configuration translations.
Namespace
Drupal\lingotekCode
public function checkConfigTargetStatus($mapper_id, $locale) {
$mapper = $this->mappers[$mapper_id];
$profile = $this->lingotekConfiguration
->getConfigProfile($mapper_id);
if ($profile
->id() === Lingotek::PROFILE_DISABLED || $this
->getConfigSourceStatus($mapper) === Lingotek::STATUS_CANCELLED) {
return FALSE;
}
$langcode = $this->languageLocaleMapper
->getConfigurableLanguageForLocale($locale)
->getId();
$current_status = $this
->getConfigTargetStatus($mapper, $langcode);
$source_status = $this
->getConfigSourceStatus($mapper);
$document_id = $this
->getConfigDocumentId($mapper);
if (($current_status == Lingotek::STATUS_PENDING || $current_status == Lingotek::STATUS_EDITED) && $source_status !== Lingotek::STATUS_EDITED) {
$translation_status = $this->lingotek
->getDocumentTranslationStatus($document_id, $locale);
if ($translation_status === Lingotek::STATUS_CANCELLED) {
$this
->setConfigTargetStatus($mapper, $langcode, Lingotek::STATUS_CANCELLED);
}
elseif ($translation_status === TRUE) {
$current_status = Lingotek::STATUS_READY;
$this
->setConfigTargetStatus($mapper, $langcode, $current_status);
}
elseif ($this->lingotek
->downloadDocument($document_id, $locale)) {
// TODO: Set Status to STATUS_READY_INTERIM when that status is
// available. See ticket https://www.drupal.org/node/2850548
}
}
if ($this
->getConfigSourceStatus($mapper) == Lingotek::STATUS_DISABLED) {
$this
->setConfigTargetStatuses($mapper, Lingotek::STATUS_DISABLED);
}
return $current_status;
}