function _locale_export_string
Print out a string on multiple lines
Related topics
1 call to _locale_export_string()
- _locale_export_po_generate in includes/
locale.inc - Generates the PO(T) file contents for given strings.
File
-
includes/
locale.inc, line 1805
Code
function _locale_export_string($str) {
$stri = addcslashes($str, "\x00..\x1f\\\"");
$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);
}
// Multiline string
if (count($parts) > 1) {
return "\"\"\n\"" . implode("\"\n\"", $parts) . "\"\n";
}
elseif (count($parts) == 1) {
return "\"{$parts[0]}\"\n";
}
else {
return "\"\"\n";
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.