bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Comment processing behavior when using line breaks in PHP


From: Steven
Subject: Comment processing behavior when using line breaks in PHP
Date: Tue, 27 Apr 2021 05:20:14 +0000

Hello,

I'd like to clarify if there may be a bug (or feature) when processing 
translator comments within PHP code that contains a line break (Unix style - 
LF) before the first function argument (which is valid PHP syntax).

For example, given the following PHP file (Filename: test.php, Unix line 
breaks, UTF-8 encoding):

  <?php
  /// TRANSLATORS: Test comment
  _(
  'Test');

If we run the following command (using Windows 10):

  .\xgettext.exe -L PHP --add-comments=TRANSLATORS: test.php

...the resulting messages.po output file is missing the translator comment:

  #: test.php:5
  msgid "Test"
  msgstr ""

However, if we modify the PHP file (test.php) to the following:

  <?php
  /// TRANSLATORS: Test comment
  _(''.
  'Test');

...and run the same xgettext command, the resulting messages.po output file now 
contains the comment:

  #. TRANSLATORS: Test comment
  #: test.php:4
  msgid "Test"
  msgstr ""

We expected the comment to appear in the first messages.po file, given the 
first PHP file uses valid PHP syntax.

Many thanks for your advice.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]