默认情况下,xgettext忽略在注释块中找到的任何关键字。
<?php // file.php
echo _('This text will be found');
//_('This text will be ignored');是否有可能推翻这种行为?我尝试过添加//_作为关键字,但这也失败了。评论似乎优先于关键词:
xgettext -o output.po --language=PHP -k_ -k//_ file.php
谢谢你帮忙!
发布于 2011-10-04 09:19:52
看来,xgettext过滤掉了注释,我不知道有什么方法可以避免这种情况。但是,作为另一种解决方案,您可以在将文件输入xgettext之前使用sed替换注释:
sed 's/\/\/_/_/g' file.php | xgettext -o output.po --language=PHP -https://stackoverflow.com/questions/7645319
复制相似问题