You are here

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

Same name and namespace in other branches
  1. 8.2 src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::getSourceStatusText()
  2. 3.0.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::getSourceStatusText()
  3. 3.1.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::getSourceStatusText()
  4. 3.2.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 181

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');
    case Lingotek::STATUS_ARCHIVED:
      return $this
        ->t('This document was archived in Lingotek. Re-upload to translate.');
    case Lingotek::STATUS_DELETED:
      return $this
        ->t('This document was deleted in Lingotek. Re-upload to translate.');
    default:
      return ucfirst(strtolower($source_status));
  }
}