protected function Xliff::writeData

Writes text according to the XLIFF export settings.

Parameters

string $text: The contents of the text.

array $key_array: The source item data key.

Return value

bool TRUE on success or FALSE on failure.

1 call to Xliff::writeData()
Xliff::addTransUnit in translators/tmgmt_file/src/Plugin/tmgmt_file/Format/Xliff.php
Adds a single translation unit for a data element.

File

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

Class

Xliff
Export to XLIFF format.

Namespace

Drupal\tmgmt_file\Plugin\tmgmt_file\Format

Code

protected function writeData($text, array $key_array) {
  if ($this->job
    ->getSetting('xliff_cdata')) {
    return $this
      ->writeCdata(trim($text));
  }
  if ($this->job
    ->getSetting('xliff_processing')) {
    return $this
      ->writeRaw($this
      ->processForExport($text, $key_array));
  }
  return $this
    ->text($text);
}