Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inserting translator notes/comments in PHP files

I am working on translating an application I am developing. I have strings like:

echo _("Welcome to my site");

I can then use the command line to create a .po file from all the PHP files in a particular directory by doing:

find . -iname "*.php" | xargs xgettext

However, when I import this into Poedit, I see a box called "Notes for translators". This may be useful sometimes, however I can't figure out how to populate it. What code do I need to add to my PHP file so that xgettext will add notes to translators?

like image 717
Mike Avatar asked Jan 14 '23 09:01

Mike


1 Answers

the help of xgettext shows:

-cTAG, --add-comments=TAG place comment blocks starting with TAG and preceding keyword lines in output file -c, --add-comments place all comment blocks preceding keyword lines in output file

so add in your file by example:

// COMMENTTAG: This is another block comment that will be extracted by xgettext.

And run xgettext with --add-comments=COMMENTTAG

like image 72
Bass Jobsen Avatar answered Jan 24 '23 05:01

Bass Jobsen