You are here

function _locale_export_wrap in Drupal 4

Same name and namespace in other branches
  1. 5 includes/locale.inc \_locale_export_wrap()
  2. 6 includes/locale.inc \_locale_export_wrap()
  3. 7 includes/locale.inc \_locale_export_wrap()

Custom word wrapping for Portable Object (Template) files.

@author Jacobo Tarrio

1 call to _locale_export_wrap()
_locale_export_print in includes/locale.inc
Print out a string on multiple lines

File

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

Code

function _locale_export_wrap($str, $len) {
  $words = explode(' ', $str);
  $ret = array();
  $cur = "";
  $nstr = 1;
  while (count($words)) {
    $word = array_shift($words);
    if ($nstr) {
      $cur = $word;
      $nstr = 0;
    }
    elseif (strlen("{$cur} {$word}") > $len) {
      $ret[] = $cur . " ";
      $cur = $word;
    }
    else {
      $cur = "{$cur} {$word}";
    }
  }
  $ret[] = $cur;
  return implode("\n", $ret);
}