function lingotek_add_target_locales in Lingotek Translation 7.7
1 string reference to 'lingotek_add_target_locales'
- lingotek_batch_update_entity_languages_by_profile in ./lingotek.batch.inc
File
- ./lingotek.batch.inc, line 871
- Central location for batch create functions, before control is handed off to individual batch command files.
Code
function lingotek_add_target_locales($entity_params, $locales, LingotekProfile $profile, &$context) {
$document_id = $entity_params['document_id'];
$entity_type = $entity_params['type'];
$entity_id = $entity_params['id'];
if (empty($context['results'])) {
$context['results'] = array();
}
if (empty($context['results']['added'])) {
$context['results']['added'] = 0;
}
$api = LingotekApi::instance();
$document = $api
->getDocument($document_id);
foreach ($locales as $l) {
if ($document->sourceLanguage == $l) {
continue;
}
$workflow_id = $profile
->getWorkflow($l);
$result = $api
->addTranslationTarget($document_id, NULL, $l, $workflow_id);
if ($result) {
LingotekSync::setTargetStatus($entity_type, $entity_id, $l, LingotekSync::STATUS_PENDING);
$context['results']['added']++;
}
}
}