You are here

protected function TMGMTFileformatXLIFF::writeIMG in Translation Management Tool 7

Writes img tag.

Note that alt and title attributes are not written as sub elements as Trados studio is not able to deal with two sub elements at one level.

Parameters

XMLWriter $writer: Writer that writes the output.

DOMElement $node: Current node.

$id: Current node id.

1 call to TMGMTFileformatXLIFF::writeIMG()
TMGMTFileformatXLIFF::processForExport in translators/file/tmgmt_file.format.xliff.inc
Helper function to process the source text.

File

translators/file/tmgmt_file.format.xliff.inc, line 585

Class

TMGMTFileformatXLIFF
Export to XLIFF format.

Code

protected function writeIMG(XMLWriter $writer, DOMElement $node, $id) {
  $writer
    ->startElement('ph');
  $writer
    ->writeAttribute('id', $id);
  $writer
    ->writeAttribute('ctype', 'image');
  foreach ($node->attributes as $attribute) {

    // @todo - uncomment when issue with Trados/sub elements fixed.

    /*
    if (in_array($attribute->name, array('title', 'alt'))) {
      continue;
    }
    */
    $writer
      ->writeAttribute($attribute->name, $attribute->value);
  }

  /*
  if ($alt_attribute = $node->getAttribute('alt')) {
    $writer->startElement('sub');
    $writer->writeAttribute('id', $id . '-img-alt');
    $writer->writeAttribute('ctype', 'x-img-alt');
    $writer->text($alt_attribute);
    $writer->endElement();
    $this->elementsCount++;
  }
  if ($title_attribute = $node->getAttribute('title')) {
    $writer->startElement('sub');
    $writer->writeAttribute('id', $id . '-img-title');
    $writer->writeAttribute('ctype', 'x-img-title');
    $writer->text($title_attribute);
    $writer->endElement();
    $this->elementsCount++;
  }
  */
  $writer
    ->endElement();
}