PoItem::formatString
private function PoItem::formatString
private PoItem::formatString($string)
Formats a string for output on multiple lines.
File
- core/lib/Drupal/Component/Gettext/PoItem.php, line 262
Class
- PoItem
- PoItem handles one translation.
Namespace
Drupal\Component\GettextCode
private function formatString($string) { // Escape characters for processing. $string = addcslashes($string, "\0..\37\\\""); // Always include a line break after the explicit \n line breaks from // the source string. Otherwise wrap at 70 chars to accommodate the extra // format overhead too. $parts = explode("\n", wordwrap(str_replace('\n', "\\n\n", $string), 70, " \n")); // Multiline string should be exported starting with a "" and newline to // have all lines aligned on the same column. if (count($parts) > 1) { return "\"\"\n\"" . implode("\"\n\"", $parts) . "\"\n"; } // Single line strings are output on the same line. else { return "\"$parts [0]\"\n"; } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Gettext!PoItem.php/function/PoItem::formatString/8.1.x