You are here

protected function LingotekTargetTrait::getTargetStatusText in Lingotek Translation 3.7.x

Same name and namespace in other branches
  1. 4.0.x src/Element/LingotekTargetTrait.php \Drupal\lingotek\Element\LingotekTargetTrait::getTargetStatusText()
  2. 3.6.x src/Element/LingotekTargetTrait.php \Drupal\lingotek\Element\LingotekTargetTrait::getTargetStatusText()
  3. 3.8.x src/Element/LingotekTargetTrait.php \Drupal\lingotek\Element\LingotekTargetTrait::getTargetStatusText()

Get the target status label.

Parameters

string $status: The target status.

string $langcode: The language code.

Return value

string The source status human-friendly label.

4 calls to LingotekTargetTrait::getTargetStatusText()
LingotekTargetStatus::preRender in src/Element/LingotekTargetStatus.php
Calculates the url and status title and adds them to the render array.
LingotekTargetStatuses::getTranslationsStatuses in src/Element/LingotekTargetStatuses.php
Gets the translation status of an entity in a format ready to display.
LingotekTargetStatuses::getTranslationsStatusesForConfigMapper in src/Element/LingotekTargetStatuses.php
LingotekTargetStatuses::getTranslationsStatusesForUI in src/Element/LingotekTargetStatuses.php

File

src/Element/LingotekTargetTrait.php, line 271

Class

LingotekTargetTrait
Trait for lingotek_target_status and lingotek_target_statuses reuse.

Namespace

Drupal\lingotek\Element

Code

protected function getTargetStatusText($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');
    case Lingotek::STATUS_DELETED:
      return $language
        ->label() . ' - ' . $this
        ->t('Deleted in Lingotek');
    case Lingotek::STATUS_ARCHIVED:
      return $language
        ->label() . ' - ' . $this
        ->t('Archived in Lingotek');
    default:
      return $language
        ->label() . ' - ' . ucfirst(strtolower($status));
  }
}