protected function LingotekTargetStatus::getTargetStatusText in Lingotek Translation 3.2.x
Same name and namespace in other branches
- 8.2 src/Element/LingotekTargetStatus.php \Drupal\lingotek\Element\LingotekTargetStatus::getTargetStatusText()
- 3.0.x src/Element/LingotekTargetStatus.php \Drupal\lingotek\Element\LingotekTargetStatus::getTargetStatusText()
- 3.1.x src/Element/LingotekTargetStatus.php \Drupal\lingotek\Element\LingotekTargetStatus::getTargetStatusText()
- 3.3.x src/Element/LingotekTargetStatus.php \Drupal\lingotek\Element\LingotekTargetStatus::getTargetStatusText()
- 3.4.x src/Element/LingotekTargetStatus.php \Drupal\lingotek\Element\LingotekTargetStatus::getTargetStatusText()
- 3.5.x src/Element/LingotekTargetStatus.php \Drupal\lingotek\Element\LingotekTargetStatus::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 LingotekTargetStatus::getTargetStatusText()
- LingotekTargetStatus::preRender in src/
Element/ LingotekTargetStatus.php - Calculates the url and status title and adds them to the render array.
File
- src/
Element/ LingotekTargetStatus.php, line 74
Class
- LingotekTargetStatus
- Provides a Lingotek target status element.
Namespace
Drupal\lingotek\ElementCode
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));
}
}