public function Lingotek::addTarget in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/Lingotek.php \Drupal\lingotek\Lingotek::addTarget()
- 4.0.x src/Lingotek.php \Drupal\lingotek\Lingotek::addTarget()
- 3.0.x src/Lingotek.php \Drupal\lingotek\Lingotek::addTarget()
- 3.1.x src/Lingotek.php \Drupal\lingotek\Lingotek::addTarget()
- 3.2.x src/Lingotek.php \Drupal\lingotek\Lingotek::addTarget()
- 3.3.x src/Lingotek.php \Drupal\lingotek\Lingotek::addTarget()
- 3.4.x src/Lingotek.php \Drupal\lingotek\Lingotek::addTarget()
- 3.5.x src/Lingotek.php \Drupal\lingotek\Lingotek::addTarget()
- 3.6.x src/Lingotek.php \Drupal\lingotek\Lingotek::addTarget()
- 3.7.x src/Lingotek.php \Drupal\lingotek\Lingotek::addTarget()
- 3.8.x src/Lingotek.php \Drupal\lingotek\Lingotek::addTarget()
Requests a translation to the Lingotek service.
Parameters
string $doc_id: The document id to translate.
string $locale: The Lingotek locale to request.
\Drupal\lingotek\LingotekProfileInterface $profile: The profile being used.
Return value
mixed
Overrides LingotekInterface::addTarget
File
- src/
Lingotek.php, line 244 - Contains \Drupal\lingotek\Lingotek.
Class
Namespace
Drupal\lingotekCode
public function addTarget($doc_id, $locale, LingotekProfileInterface $profile = NULL) {
$workflow_id = NULL;
$drupal_language = $this->languageLocaleMapper
->getConfigurableLanguageForLocale($locale);
if ($profile !== NULL && ($workflow_id = $profile
->getWorkflowForTarget($drupal_language
->getId()))) {
if ($workflow_id === 'default') {
$workflow_id = $this
->get('default.workflow');
}
}
$response = $this->api
->addTranslation($doc_id, $locale, $workflow_id);
if ($response
->getStatusCode() == Response::HTTP_CREATED) {
return TRUE;
}
return FALSE;
}