Gettext icon indicating copy to clipboard operation
Gettext copied to clipboard

Use multiline strings in PO files

Open ScreamingDev opened this issue 8 years ago • 1 comments

Po-Files can have multiline strings:

#. Description of the plugin/theme
msgid ""
"Twenty Sixteen is a modernized take on an ever-popular WordPress layout — "
"the horizontal masthead with an optional right sidebar that works perfectly "
"for blogs and websites. It has custom color options with beautiful default "
"color schemes, a harmonious fluid grid using a mobile-first approach, and "
"impeccable polish in every detail. Twenty Sixteen will make your WordPress "
"look beautiful everywhere."
msgstr ""

This makes it more readable in the IDE than a looooong single-line string.

ScreamingDev avatar Jun 12 '16 23:06 ScreamingDev

This would need a multibyte safe wordwrap() function that also preserves trailing whitespace.

I mention whitespace because this:

$string = wordwrap('Twenty Sixteen is a modernized take on an ever-popular WordPress layout — the horizontal masthead with an optional right sidebar that works perfectly ', 78);
var_dump(explode("\n", $string));

will result in this:

array(2) {
  [0]=>
  string(75) "Twenty Sixteen is a modernized take on an ever-popular WordPress layout —"
  [1]=>
  string(76) "the horizontal masthead with an optional right sidebar that works perfectly "
}

Note the missing space after the dash.

swissspidy avatar Feb 22 '18 14:02 swissspidy