protected function Xliff::addItem in Translation Management Tool 8
Adds a job item to the xml export.
Parameters
$item: The job item entity.
1 call to Xliff::addItem()
- Xliff::export in translators/
tmgmt_file/ src/ Plugin/ tmgmt_file/ Format/ Xliff.php - Return the file content for the job data.
File
- translators/
tmgmt_file/ src/ Plugin/ tmgmt_file/ Format/ Xliff.php, line 101
Class
- Xliff
- Export to XLIFF format.
Namespace
Drupal\tmgmt_file\Plugin\tmgmt_file\FormatCode
protected function addItem(JobItemInterface $item) {
$this
->startElement('group');
$this
->writeAttribute('id', $item
->id());
// Add a note for the source label.
$this
->writeElement('note', $item
->getSourceLabel());
// @todo: Write in nested groups instead of flattening it.
$data = \Drupal::service('tmgmt.data')
->filterTranslatable($item
->getData());
foreach ($data as $key => $element) {
$this
->addTransUnit($item
->id() . '][' . $key, $element, $this->job);
}
$this
->endElement();
}