You are here

public function TMGMTFileformatXLIFF::import in Translation Management Tool 7

Converts an exported file content back to the translated data.

Parameters

string $imported_file: Path to a file or an XML string to import.

bool $is_file: (optional) Whether $imported_file is the path to a file or not.

Return value

Translated data array.

Overrides TMGMTFileFormatInterface::import

File

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

Class

TMGMTFileformatXLIFF
Export to XLIFF format.

Code

public function import($imported_file, $is_file = TRUE) {
  if (!$this
    ->getImportedXML($imported_file, $is_file)) {
    return FALSE;
  }
  $phase = $this->importedXML
    ->xpath("//xliff:phase[@phase-name='extraction']");
  $phase = reset($phase);
  $job = tmgmt_job_load((string) $phase['job-id']);
  return tmgmt_unflatten_data($this
    ->getImportedTargets($job));
}