You are here

function _locale_export_string in Translation template extractor 8

Print out a string on multiple lines.

1 call to _locale_export_string()
_potx_translation_export in ./potx.inc
Export translations with a specific language.

File

./potx.locale.inc, line 11
Contains locale functions that were removed in Drupal 8.

Code

function _locale_export_string($str) {
  $stri = addcslashes($str, "\0..\37\\\"");
  $parts = [];

  // Cut text into several lines.
  while ($stri != "") {
    $i = strpos($stri, "\\n");
    if ($i === FALSE) {
      $curstr = $stri;
      $stri = "";
    }
    else {
      $curstr = substr($stri, 0, $i + 2);
      $stri = substr($stri, $i + 2);
    }
    $curparts = explode("\n", _locale_export_wrap($curstr, 70));
    $parts = array_merge($parts, $curparts);
  }

  // Multiline string.
  if (count($parts) > 1) {
    return "\"\"\n\"" . implode("\"\n\"", $parts) . "\"\n";
  }
  elseif (count($parts) == 1) {
    return "\"{$parts[0]}\"\n";
  }
  else {
    return "\"\"\n";
  }
}