public function LingotekApi::addTranslationTarget in Lingotek Translation 7.7
Same name and namespace in other branches
- 7.2 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::addTranslationTarget()
- 7.3 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::addTranslationTarget()
- 7.4 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::addTranslationTarget()
- 7.5 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::addTranslationTarget()
- 7.6 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::addTranslationTarget()
Adds a target language to an existing Lingotek Document or Project.
Parameters
int $lingotek_document_id: The document to which the new translation target should be added. Or null if the target will be added to the project.
int $lingotek_project_id: The project to which the new translation target should be added. Or null if the target will be added to a document instead.
string $lingotek_locale: The two letter code representing the language which should be added as a translation target.
string $workflow_id: The optional workflow to associate with this target. If omitted, the project's default workflow will be applied.
Return value
mixed The ID of the new translation target in the Lingotek system, or FALSE on error.
1 call to LingotekApi::addTranslationTarget()
- LingotekApi::upload_language_specific_targets in lib/
Drupal/ lingotek/ LingotekApi.php - Waits until document import status is complete, then adds targets, or logs an error
File
- lib/
Drupal/ lingotek/ LingotekApi.php, line 390 - Defines Drupal\lingotek\LingotekApi
Class
- LingotekApi
- @file Defines Drupal\lingotek\LingotekApi
Code
public function addTranslationTarget($lingotek_document_id, $lingotek_project_id, $lingotek_locale, $workflow_id = '') {
$parameters = array(
'targetLanguage' => $lingotek_locale,
);
if (isset($lingotek_document_id) && !isset($lingotek_project_id)) {
$parameters['documentId'] = $lingotek_document_id;
}
elseif (isset($lingotek_project_id) && !isset($lingotek_document_id)) {
$parameters['projectId'] = $lingotek_project_id;
}
if ($workflow_id) {
$parameters['workflowId'] = $workflow_id;
}
else {
// The associated project's Workflow template should be applied.
$parameters['applyWorkflow'] = 'true';
}
if ($this
->request('addTranslationTarget', $parameters)) {
return TRUE;
}
return FALSE;
}