You are here

protected function LingotekSourceStatus::getSourceStatusText in Lingotek Translation 3.2.x

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

Get the source status label.

Parameters

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

string $source_status: The source status

Return value

string The source status human-friendly label.

1 call to LingotekSourceStatus::getSourceStatusText()
LingotekSourceStatus::preRender in src/Element/LingotekSourceStatus.php
Calculates the url and status title and adds them to the render array.

File

src/Element/LingotekSourceStatus.php, line 124

Class

LingotekSourceStatus
Provides a Lingotek source status element.

Namespace

Drupal\lingotek\Element

Code

protected function getSourceStatusText(ContentEntityInterface $entity, $source_status) {
  switch ($source_status) {
    case Lingotek::STATUS_UNTRACKED:
    case Lingotek::STATUS_REQUEST:
      return t('Upload');
    case Lingotek::STATUS_DISABLED:
      return t('Disabled, cannot request translation');
    case Lingotek::STATUS_EDITED:
      return \Drupal::service('lingotek.content_translation')
        ->getDocumentId($entity) ? t('Re-upload (content has changed since last upload)') : t('Upload');
    case Lingotek::STATUS_IMPORTING:
      return t('Source importing');
    case Lingotek::STATUS_CURRENT:
      return t('Source uploaded');
    case Lingotek::STATUS_ERROR:
      return t('Error');
    case Lingotek::STATUS_CANCELLED:
      return $this
        ->t('Cancelled by user');
    default:
      return ucfirst(strtolower($source_status));
  }
}