You are here

public function TranslationRequestManager::getTranslationRequest in TMGMT Translator Smartling 8.4

Returns translation request.

Parameters

\Drupal\tmgmt\JobInterface $job:

Return value

string

2 calls to TranslationRequestManager::getTranslationRequest()
TranslationRequestManager::isTranslationRequestReadyForDownload in src/Smartling/Submission/TranslationRequestManager.php
Check if job ready for download.
TranslationRequestManager::upsertTranslationRequest in src/Smartling/Submission/TranslationRequestManager.php
Send jobs to Submission service.

File

src/Smartling/Submission/TranslationRequestManager.php, line 134

Class

TranslationRequestManager
Class TranslationRequestManager.

Namespace

Drupal\tmgmt_smartling\Smartling\Submission

Code

public function getTranslationRequest(JobInterface $job) {
  $this
    ->initApiWrapper($job);
  $asset_key = [
    'tmgmt_job_id' => $job
      ->id(),
  ];
  $search_params = new SearchTranslationRequestParams();
  $search_params
    ->setOriginalAssetKey($asset_key);
  $search_params
    ->setTargetAssetKey($asset_key);
  $search_params
    ->setTargetLocaleId($job
    ->getRemoteTargetLanguage());
  $search_params
    ->setLimit(1);
  $translation_requests = $this->apiWrapper
    ->searchTranslationRequest($this
    ->getBucketName($job), $search_params);
  return empty($translation_requests) ? $translation_requests : $translation_requests[0];
}