public function Lingotek::getDocumentTranslationStatuses in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/Lingotek.php \Drupal\lingotek\Lingotek::getDocumentTranslationStatuses()
- 4.0.x src/Lingotek.php \Drupal\lingotek\Lingotek::getDocumentTranslationStatuses()
- 3.0.x src/Lingotek.php \Drupal\lingotek\Lingotek::getDocumentTranslationStatuses()
- 3.1.x src/Lingotek.php \Drupal\lingotek\Lingotek::getDocumentTranslationStatuses()
- 3.2.x src/Lingotek.php \Drupal\lingotek\Lingotek::getDocumentTranslationStatuses()
- 3.3.x src/Lingotek.php \Drupal\lingotek\Lingotek::getDocumentTranslationStatuses()
- 3.4.x src/Lingotek.php \Drupal\lingotek\Lingotek::getDocumentTranslationStatuses()
- 3.5.x src/Lingotek.php \Drupal\lingotek\Lingotek::getDocumentTranslationStatuses()
- 3.6.x src/Lingotek.php \Drupal\lingotek\Lingotek::getDocumentTranslationStatuses()
- 3.7.x src/Lingotek.php \Drupal\lingotek\Lingotek::getDocumentTranslationStatuses()
- 3.8.x src/Lingotek.php \Drupal\lingotek\Lingotek::getDocumentTranslationStatuses()
Overrides LingotekInterface::getDocumentTranslationStatuses
File
- src/
Lingotek.php, line 358 - Contains \Drupal\lingotek\Lingotek.
Class
Namespace
Drupal\lingotekCode
public function getDocumentTranslationStatuses($doc_id) {
$statuses = array();
try {
$response = $this->api
->getDocumentTranslationStatuses($doc_id);
} catch (LingotekApiException $e) {
// No targets found for this doc
return $statuses;
}
if ($response
->getStatusCode() == Response::HTTP_OK) {
$progress_json = json_decode($response
->getBody(), TRUE);
if (!empty($progress_json['entities'])) {
foreach ($progress_json['entities'] as $index => $data) {
$lingotek_locale = $data['properties']['locale_code'];
$statuses[$lingotek_locale] = $data['properties']['percent_complete'];
}
}
}
return $statuses;
}