You are here

function lingotek_machine_translate_node in Lingotek Translation 7.2

Batch Worker Function: Machine Translate a Node.

1 string reference to 'lingotek_machine_translate_node'
lingotek_bulk_mt_upload_batch_create in ./lingotek.batch.inc
Batch Create - Upload: Create a Bulk Machine Translate UPLOAD Batch.

File

./lingotek.batch.inc, line 455

Code

function lingotek_machine_translate_node($nid, &$context) {
  watchdog('ltk_upload', 'nide: @node_id', array(
    '@node_id' => $nid,
  ), WATCHDOG_DEBUG);
  $api = LingotekApi::instance();
  $node = node_load($nid);

  // Push this node for translation.
  if ($existing_document = lingotek_lingonode($node->nid, 'document_id')) {

    // Update an existing Lingotek Document.
    $api
      ->updateContentDocument($node);
  }
  else {

    // Create a new Lingotek Document.
    $api
      ->addContentDocument($node, TRUE);
  }
  $context['results'][] = 'Upload Node: ' . $nid;
}