2

As default, xgettext ignores any keyword found within a comment block.

<?php // file.php
echo _('This text will be found');
//_('This text will be ignored');

Is it possible to override this behaviour? I've tried by adding //_ as a keyword, but this fails as well. It seems comments have priority over keywords:

xgettext -o output.po --language=PHP -k_ -k//_ file.php

Thanks for help!

ANisus
  • 74,460
  • 29
  • 162
  • 158

1 Answers1

3

It seems, that xgettext filters out comments and i do not know of a way to avoid this. However, as an alternative solution you could just use sed to replace comments before feeding the file to xgettext:

sed 's/\/\/_/_/g' file.php | xgettext -o output.po --language=PHP -
aurora
  • 9,607
  • 7
  • 36
  • 54
  • Aah, that is a nice creative solution! Thanks for the idea and help! – ANisus Oct 04 '11 at 09:21
  • I don't know if this is possible with only poedit. I am using poedit only as editor not for generating .po files, because in my case i have some additional datasources (database) i feed into the .po files. I've had a quick look at the preferences of poedit, but it doesn't seem to have any possibilities to configure such things ... – aurora Nov 14 '13 at 08:32