You are here

function _locale_export_print in Drupal 5

Same name and namespace in other branches
  1. 4 includes/locale.inc \_locale_export_print()

Print out a string on multiple lines

1 call to _locale_export_print()
_locale_export_po in includes/locale.inc
Exports a Portable Object (Template) file for a language

File

includes/locale.inc, line 1263
Admin-related functions for locale.module.

Code

function _locale_export_print($str) {
  $stri = addcslashes($str, "\0..\37\\\"");
  $parts = array();

  // 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);
  }
  if (count($parts) > 1) {
    return "\"\"\n\"" . implode("\"\n\"", $parts) . "\"\n";
  }
  else {
    return "\"{$parts[0]}\"\n";
  }
}