public function LingotekInterfaceTranslationService::cancelDocumentTarget in Lingotek Translation 3.5.x
Same name and namespace in other branches
- 4.0.x src/LingotekInterfaceTranslationService.php \Drupal\lingotek\LingotekInterfaceTranslationService::cancelDocumentTarget()
- 3.2.x src/LingotekInterfaceTranslationService.php \Drupal\lingotek\LingotekInterfaceTranslationService::cancelDocumentTarget()
- 3.3.x src/LingotekInterfaceTranslationService.php \Drupal\lingotek\LingotekInterfaceTranslationService::cancelDocumentTarget()
- 3.4.x src/LingotekInterfaceTranslationService.php \Drupal\lingotek\LingotekInterfaceTranslationService::cancelDocumentTarget()
- 3.6.x src/LingotekInterfaceTranslationService.php \Drupal\lingotek\LingotekInterfaceTranslationService::cancelDocumentTarget()
- 3.7.x src/LingotekInterfaceTranslationService.php \Drupal\lingotek\LingotekInterfaceTranslationService::cancelDocumentTarget()
- 3.8.x src/LingotekInterfaceTranslationService.php \Drupal\lingotek\LingotekInterfaceTranslationService::cancelDocumentTarget()
Cancels a translation for a given component in the given locale.
Parameters
string $component: The component which target we want to cancel.
string $locale: Lingotek translation language which we want to modify.
Overrides LingotekInterfaceTranslationServiceInterface::cancelDocumentTarget
File
- src/
LingotekInterfaceTranslationService.php, line 806
Class
- LingotekInterfaceTranslationService
- Service for managing Lingotek interface translations.
Namespace
Drupal\lingotekCode
public function cancelDocumentTarget($component, $locale) {
$source_langcode = 'en';
$source_locale = $this->languageLocaleMapper
->getLocaleForLangcode($source_langcode);
if ($locale == $source_locale) {
// This is not a target, but the source language itself.
return FALSE;
}
if ($document_id = $this
->getDocumentId($component)) {
$drupal_language = $this->languageLocaleMapper
->getConfigurableLanguageForLocale($locale);
if ($this->lingotek
->cancelDocumentTarget($document_id, $locale)) {
$this
->setTargetStatus($component, $drupal_language
->id(), Lingotek::STATUS_CANCELLED);
return TRUE;
}
}
return FALSE;
}