public function LingotekInterfaceTranslationController::download in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 4.0.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::download()
- 3.2.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::download()
- 3.3.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::download()
- 3.4.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::download()
- 3.5.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::download()
- 3.6.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::download()
- 3.8.x src/Controller/LingotekInterfaceTranslationController.php \Drupal\lingotek\Controller\LingotekInterfaceTranslationController::download()
1 string reference to 'LingotekInterfaceTranslationController::download'
File
- src/
Controller/ LingotekInterfaceTranslationController.php, line 225
Class
Namespace
Drupal\lingotek\ControllerCode
public function download(Request $request) {
$component = $request->query
->get('component');
$locale = $request->query
->get('locale');
if ($component && $locale) {
try {
if ($this->lingotekInterfaceTranslation
->downloadDocument($component, $locale)) {
$this
->messenger()
->addStatus($this
->t('The translation of %label into @locale has been downloaded.', [
'@locale' => $locale,
'%label' => $component,
]));
}
else {
$this
->messenger()
->addStatus($this
->t("The '@locale' translation download for %label failed. Please try again.", [
'@locale' => $locale,
'%label' => $component,
]));
}
} catch (LingotekDocumentNotFoundException $exception) {
$this
->messenger()
->addError($this
->t('Document %label was not found. Please upload again.', [
'%label' => $component,
]));
} catch (LingotekDocumentArchivedException $exception) {
$this
->messenger()
->addWarning($this
->t('Document %label has been archived. Uploading again.', [
'%label' => $component,
]));
return $this
->upload($request);
} catch (LingotekDocumentLockedException $exception) {
$this
->messenger()
->addError($this
->t('Document %label has a new version. The document id has been updated for all future interactions. Please try again.', [
'%label' => $component,
]));
} catch (LingotekPaymentRequiredException $exception) {
$this
->messenger()
->addError($this
->t('Community has been disabled. Please contact support@lingotek.com to re-enable your community.'));
} catch (LingotekApiException $e) {
$this
->messenger()
->addError($this
->t("The '@locale' translation download for %label failed. Please try again.", [
'%label' => $component,
'@locale' => $locale,
]));
}
}
return new RedirectResponse($request
->getRequestUri());
}