You are here

protected function TMGMTFileformatXLIFF::getImportedTargets in Translation Management Tool 7

2 calls to TMGMTFileformatXLIFF::getImportedTargets()
TMGMTFileformatXLIFF::import in translators/file/tmgmt_file.format.xliff.inc
Converts an exported file content back to the translated data.
TMGMTFileformatXLIFF::validateImport in translators/file/tmgmt_file.format.xliff.inc
Validates that the given file is valid and can be imported.

File

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

Class

TMGMTFileformatXLIFF
Export to XLIFF format.

Code

protected function getImportedTargets(TMGMTJob $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;
}