protected function Xliff::getImportedTargets

2 calls to Xliff::getImportedTargets()
Xliff::import in translators/tmgmt_file/src/Plugin/tmgmt_file/Format/Xliff.php
Converts an exported file content back to the translated data.
Xliff::validateImport in translators/tmgmt_file/src/Plugin/tmgmt_file/Format/Xliff.php
Validates that the given file is valid and can be imported.

File

translators/tmgmt_file/src/Plugin/tmgmt_file/Format/Xliff.php, line 384

Class

Xliff
Export to XLIFF format.

Namespace

Drupal\tmgmt_file\Plugin\tmgmt_file\Format

Code

protected function getImportedTargets(JobInterface $job) {
  if (empty($this->importedXML)) {
    return FALSE;
  }
  if (empty($this->importedTransUnits)) {
    $reader = new \XMLReader();
    foreach ($this->importedXML
      ->xpath('//xliff:trans-unit') as $unit) {
      if (!$job
        ->getSetting('xliff_processing')) {
        $this->importedTransUnits[(string) $unit['id']]['#text'] = (string) $unit->target;
        continue;
      }
      $reader
        ->XML($unit->target
        ->asXML());
      $reader
        ->read();
      $this->importedTransUnits[(string) $unit['id']]['#text'] = $this
        ->processForImport($reader
        ->readInnerXML(), $job);
    }
  }
  return $this->importedTransUnits;
}