You are here

public function LingotekFake::getDocumentTranslationStatuses in Lingotek Translation 3.6.x

Same name and namespace in other branches
  1. 8 tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getDocumentTranslationStatuses()
  2. 8.2 tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getDocumentTranslationStatuses()
  3. 4.0.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getDocumentTranslationStatuses()
  4. 3.0.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getDocumentTranslationStatuses()
  5. 3.1.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getDocumentTranslationStatuses()
  6. 3.2.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getDocumentTranslationStatuses()
  7. 3.3.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getDocumentTranslationStatuses()
  8. 3.4.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getDocumentTranslationStatuses()
  9. 3.5.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getDocumentTranslationStatuses()
  10. 3.7.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getDocumentTranslationStatuses()
  11. 3.8.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getDocumentTranslationStatuses()

Gets the status of the translations.

Parameters

string $doc_id: The document ID in Lingotek.

Return value

array Returns array keyed by the locale with the percentage of completion.

Overrides LingotekInterface::getDocumentTranslationStatuses

File

tests/modules/lingotek_test/src/LingotekFake.php, line 412

Class

LingotekFake

Namespace

Drupal\lingotek_test

Code

public function getDocumentTranslationStatuses($doc_id) {
  if (!$doc_id) {
    throw new LingotekApiException('Error requesting statuses without document id.');
  }
  if (\Drupal::state()
    ->get('lingotek.must_error_in_check_target_status', FALSE)) {
    throw new LingotekApiException('Error was forced.');
  }
  $statuses = \Drupal::state()
    ->get('lingotek.document_completion_statuses', []);
  if (!empty($statuses)) {
    return $statuses;
  }
  if (\Drupal::state()
    ->get('lingotek.document_completion', TRUE)) {
    return [
      'es-MX' => 100,
      'es-ES' => 100,
      'de-AT' => 100,
      'de-DE' => 100,
    ];
  }
  return [
    'es-MX' => 80,
    'es-ES' => 80,
    'de-AT' => 80,
    'de-DE' => 80,
  ];
}