You are here

public function LingotekConfigTranslationService::getTargetStatus in Lingotek Translation 3.3.x

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

Gets the translation status of a given entity translation for a locale.

Parameters

\Drupal\Core\Config\ConfigEntityInterface &$entity: The entity which status we want to get.

string $locale: Lingotek translation language which we want to get.

Return value

int The status of the target translation (see Lingotek class constants)

Overrides LingotekConfigTranslationServiceInterface::getTargetStatus

6 calls to LingotekConfigTranslationService::getTargetStatus()
LingotekConfigTranslationService::addTarget in src/LingotekConfigTranslationService.php
Request a translation for a given entity in the given locale.
LingotekConfigTranslationService::checkTargetStatus in src/LingotekConfigTranslationService.php
Checks the status of the translation in the Lingotek service.
LingotekConfigTranslationService::checkTargetStatuses in src/LingotekConfigTranslationService.php
Checks the status of all the translations in the Lingotek service.
LingotekConfigTranslationService::markTranslationsAsDirty in src/LingotekConfigTranslationService.php
Marks the translation status as dirty if they exist.
LingotekConfigTranslationService::requestTranslations in src/LingotekConfigTranslationService.php
Requests translations of a document in all the enabled locales.

... See full list

File

src/LingotekConfigTranslationService.php, line 209

Class

LingotekConfigTranslationService
Service for managing Lingotek configuration translations.

Namespace

Drupal\lingotek

Code

public function getTargetStatus(ConfigEntityInterface &$entity, $langcode) {
  $status = Lingotek::STATUS_UNTRACKED;
  $metadata = LingotekConfigMetadata::loadByConfigName($entity
    ->getEntityTypeId() . '.' . $entity
    ->id());
  $translation_status = $metadata
    ->getTargetStatus();
  if (count($translation_status) > 0 && isset($translation_status[$langcode])) {
    $status = $translation_status[$langcode];
  }
  return $status;
}