You are here

protected function LingotekTargetStatuses::getTargetStatusText in Lingotek Translation 8.2

Same name and namespace in other branches
  1. 3.0.x src/Element/LingotekTargetStatuses.php \Drupal\lingotek\Element\LingotekTargetStatuses::getTargetStatusText()
  2. 3.1.x src/Element/LingotekTargetStatuses.php \Drupal\lingotek\Element\LingotekTargetStatuses::getTargetStatusText()
  3. 3.2.x src/Element/LingotekTargetStatuses.php \Drupal\lingotek\Element\LingotekTargetStatuses::getTargetStatusText()
  4. 3.3.x src/Element/LingotekTargetStatuses.php \Drupal\lingotek\Element\LingotekTargetStatuses::getTargetStatusText()
  5. 3.4.x src/Element/LingotekTargetStatuses.php \Drupal\lingotek\Element\LingotekTargetStatuses::getTargetStatusText()
  6. 3.5.x src/Element/LingotekTargetStatuses.php \Drupal\lingotek\Element\LingotekTargetStatuses::getTargetStatusText()

Get the source status label.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity.

string $status: The target status.

string $langcode: The language code.

Return value

string The source status human-friendly label.

1 call to LingotekTargetStatuses::getTargetStatusText()
LingotekTargetStatuses::getTranslationsStatuses in src/Element/LingotekTargetStatuses.php
Gets the translation status of an entity in a format ready to display.

File

src/Element/LingotekTargetStatuses.php, line 135

Class

LingotekTargetStatuses
Provides a Lingotek target status element.

Namespace

Drupal\lingotek\Element

Code

protected function getTargetStatusText(ContentEntityInterface $entity, $status, $langcode) {
  $language = ConfigurableLanguage::load($langcode);
  switch ($status) {
    case Lingotek::STATUS_UNTRACKED:
      return $language
        ->label() . ' - ' . $this
        ->t('Translation exists, but it is not being tracked by Lingotek');
    case Lingotek::STATUS_REQUEST:
      return $language
        ->label() . ' - ' . $this
        ->t('Request translation');
    case Lingotek::STATUS_PENDING:
      return $language
        ->label() . ' - ' . $this
        ->t('In-progress');
    case Lingotek::STATUS_READY:
      return $language
        ->label() . ' - ' . $this
        ->t('Ready for Download');
    case Lingotek::STATUS_INTERMEDIATE:
      return $language
        ->label() . ' - ' . $this
        ->t('In-progress (interim translation downloaded)');
    case Lingotek::STATUS_CURRENT:
      return $language
        ->label() . ' - ' . $this
        ->t('Current');
    case Lingotek::STATUS_EDITED:
      return $language
        ->label() . ' - ' . $this
        ->t('Not current');
    case Lingotek::STATUS_ERROR:
      return $language
        ->label() . ' - ' . $this
        ->t('Error');
    case Lingotek::STATUS_CANCELLED:
      return $language
        ->label() . ' - ' . $this
        ->t('Cancelled by user');
    default:
      return $language
        ->label() . ' - ' . ucfirst(strtolower($status));
  }
}