gpt4 book ai didi

php - 让 xgettext 在评论中查找关键字

转载 作者:行者123 更新时间:2023-12-04 06:12:14 27 4
gpt4 key购买 nike

默认情况下,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
感谢您的帮助!

最佳答案

似乎 xgettext 过滤掉了评论,我不知道有什么方法可以避免这种情况。但是,作为替代解决方案,您可以在将文件提供给 xgettext 之前使用 sed 替换注释:

sed 's/\/\/_/_/g' file.php | xgettext -o output.po --language=PHP -

关于php - 让 xgettext 在评论中查找关键字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7645319/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com