1 gettext.inc | _locale_export_string($str) |
Prints a string on multiple lines.
Related topics
File
- core/
includes/ gettext.inc, line 1060 - Gettext parsing and generating API.
Code
function _locale_export_string($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);
}
// Multiline string.
if (count($parts) > 1) {
return "\"\"\n\"" . implode("\"\n\"", $parts) . "\"\n";
}
// Single line string.
elseif (count($parts) == 1) {
return "\"$parts[0]\"\n";
}
// No translation.
else {
return "\"\"\n";
}
}