protected function Xliff::writeIMG in Translation Management Tool 8
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 Xliff::writeIMG()
- Xliff::processForExport in translators/
tmgmt_file/ src/ Plugin/ tmgmt_file/ Format/ Xliff.php - Helper function to process the source text.
File
- translators/
tmgmt_file/ src/ Plugin/ tmgmt_file/ Format/ Xliff.php, line 637
Class
- Xliff
- Export to XLIFF format.
Namespace
Drupal\tmgmt_file\Plugin\tmgmt_file\FormatCode
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();
}