Ĩesky

xgettext - PHP multiline strings

xgettext doesn't consider more texts concatenated using the dot operator in the PHP script as a single string and thus it splits them as separate entries in the .po file.\r\n\r\nThis patch fixes this bug. There are several limitations:\r\n

    \r\n
  • Only quoted texts can be concatenated (they can contain variables), it's NOT possible to concatenate a quoted text and a variable
    \r\nRIGHT: $x = \"text1\" . \"text2 $variable\";
    \r\nWRONG: $x = \"text1\" . $variable;
  • \r\n
  • In case of multiline texts, it's NOT possible to use a comment between the parts of the text
    \r\nRIGHT: $x = _(\"text1\".
    \r\n\"text2\");
  • \r\nWRONG: $x = _(\"text1\". // first line
    \r\n\"text2\");\r\n
  • Only texts quoted with the same type of qoutes can ce concatenated.
    \r\nRIGHT: $x = \"text1\" . \"text2\"; // double-quotes
    \r\nWRONG: $x = \"text1\" . 'text2'; // double-quote and single quote
  • \r\n
\r\n\r\nAlthou there are few limitations this patch is quite good as it allows to split long texts to more lines and concatenate the with the dot.\r\n

Download

Filename Version Type OS
Description
gettext-x-php-concat.diff 0.16.1 Patch Un*x
Patch was developed on the gettext 0.14.6, it was successfully tested with the gettext 0.16.1. It should be possible to use with ohter versions.
© 2024 any code
TOPlist