You are here

public function ContextUploader::isReadyAcceptContext in TMGMT Translator Smartling 8.3

Same name and namespace in other branches
  1. 8.4 src/Context/ContextUploader.php \Drupal\tmgmt_smartling\Context\ContextUploader::isReadyAcceptContext()
  2. 8 src/Context/ContextUploader.php \Drupal\tmgmt_smartling\Context\ContextUploader::isReadyAcceptContext()
  3. 8.2 src/Context/ContextUploader.php \Drupal\tmgmt_smartling\Context\ContextUploader::isReadyAcceptContext()

Parameters

$filename:

Return value

bool

File

src/Context/ContextUploader.php, line 342

Class

ContextUploader

Namespace

Drupal\tmgmt_smartling\Context

Code

public function isReadyAcceptContext($filename, $proj_settings) {
  try {
    $api = $this
      ->getApiWrapper($proj_settings)
      ->getApi('file');
    $res = $api
      ->getStatusAllLocales($filename);
    if (!$res) {
      $this->logger
        ->warning('File "@filename" is not ready to accept context. Most likely it is being processed by Smartling right now.', [
        '@filename' => $filename,
      ]);
    }
    return $res;
  } catch (Exception $e) {
    $this->logger
      ->warning($e
      ->getMessage());
    return FALSE;
  }
}