[wp-trac] [WordPress Trac] #43864: A comment inside an i18n function will cause makepot/extract.php to miss the string

WordPress Trac noreply at wordpress.org
Thu Apr 26 04:34:48 UTC 2018


#43864: A comment inside an i18n function will cause makepot/extract.php to miss
the string
--------------------------+--------------------------------------
 Reporter:  julesaus      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  I18N          |    Version:
 Severity:  normal        |   Keywords:  has-patch has-unit-tests
  Focuses:                |
--------------------------+--------------------------------------
 If you put a comment inside a translation function, makepot misses the
 entire string. For example, none of these strings will appear in a
 generated pot file:

 {{{#!php
 <?php
 __( /* */ 'missing' );

 __(
   //
   'multiline missing'
 );

 __(
   // translators: This seems like a reasonable place to put a comment
   'A reasonable looking example'
 );

 }}}

 You might pop the attached `test-file.php` into `test-dir/` and run `php
 ../makepot.php generic $PWD /dev/stdout; echo;` if you'd like to see it
 yourself.

 This is valid PHP and `gettext` handles this syntax fine, so it can be
 quite tricky to recognize the problem when it occurs.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/43864>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list