You are here

public function LingotekInterfaceTranslationController::checkUpload in Lingotek Translation 3.7.x

Same name and namespace in other branches
  1. 4.0.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::checkUpload()
  2. 3.2.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::checkUpload()
  3. 3.3.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::checkUpload()
  4. 3.4.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::checkUpload()
  5. 3.5.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::checkUpload()
  6. 3.6.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::checkUpload()
  7. 3.8.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::checkUpload()
1 string reference to 'LingotekInterfaceTranslationController::checkUpload'
lingotek.routing.yml in ./lingotek.routing.yml
lingotek.routing.yml

File

src/Controller/LingotekInterfaceTranslationController.php, line 130

Class

LingotekInterfaceTranslationController

Namespace

Drupal\lingotek\Controller

Code

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());
}