public function LingotekInterfaceTranslationController::checkUpload in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 4.0.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::checkUpload()
- 3.2.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::checkUpload()
- 3.3.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::checkUpload()
- 3.4.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::checkUpload()
- 3.5.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::checkUpload()
- 3.6.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::checkUpload()
- 3.8.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::checkUpload()
1 string reference to 'LingotekInterfaceTranslationController::checkUpload'
File
- src/Controller/ LingotekInterfaceTranslationController.php, line 130 
Class
Namespace
Drupal\lingotek\ControllerCode
public function checkUpload(Request $request) {
  $component = $request->query
    ->get('component');
  if ($component) {
    try {
      if ($this->lingotekInterfaceTranslation
        ->checkSourceStatus($component)) {
        $this
          ->messenger()
          ->addStatus($this
          ->t('The import for %label is complete.', [
          '%label' => $component,
        ]));
      }
      else {
        $this
          ->messenger()
          ->addStatus($this
          ->t('The import for %label is still pending.', [
          '%label' => $component,
        ]));
      }
    } catch (LingotekDocumentNotFoundException $exc) {
      $this
        ->messenger()
        ->addError(t('Document %label was not found. Please upload again.', [
        '%label' => $component,
      ]));
    } catch (LingotekApiException $e) {
      $this
        ->messenger()
        ->addError($this
        ->t('%label status check failed. Please try again.', [
        '%label' => $component,
      ]));
    }
  }
  return new RedirectResponse($request
    ->getRequestUri());
}