1 gettext.inc | _locale_export_wrap($str, $len) |
Wraps text for Portable Object (Template) files.
Related topics
File
- core/
includes/ gettext.inc, line 1096 - Gettext parsing and generating API.
Code
function _locale_export_wrap($str, $len) {
$words = explode(' ', $str);
$return = array();
$cur = "";
$nstr = 1;
while (count($words)) {
$word = array_shift($words);
if ($nstr) {
$cur = $word;
$nstr = 0;
}
elseif (strlen("$cur $word") > $len) {
$return[] = $cur . " ";
$cur = $word;
}
else {
$cur = "$cur $word";
}
}
$return[] = $cur;
return implode("\n", $return);
}