Is there any way to hide html tags while echoing string with


Is there any way to hide html tags while echoing string with 'gettext'?

我想知道在用phpgettext函数回显字符串时是否有隐藏html标记的方法。

这就是我得到的,我想在把html标签放到.po文件之前,先从字符串中去掉它们。

<?=_('You must be logged in to add a link.<br />
If you already have a account, 
<a href="#" name="Log In">click here</a> to log in or 
<a href="#" name="Register">join us</a> now!'); ?>

这将字符串放入.po文件中,如下所示:

You must be logged in to add a link.<br />  If you already have a account, <a href="#" name="Log In">click here</a> to log in or <a href="#" name="Register">join us</a> now!

我的网站的翻译将是可公开编辑的(使用Pootle),所以我想知道有什么方法可以向公众隐藏html标签吗?有这样的吗:

You must be logged in to add a link. If you already have a account, click here to log in or join us now!

没有真正的方法可以隐藏它们并在翻译后重新插入它们,您可以使用字符位置图,但翻译后html标签的字符长度会发生变化。

如果你绝对想避免使用html标签,你可以做的是保留换行符,并在交易程序需要时将其转换为新行,例如,对html标签内的文本使用单独的翻译;

<?=_('You must be logged in to add a link.<br /> If you already have a account,') ?>
<a href="#" name="Log In"><?= _('click here') ?></a> <?= _('to log in or') ?>

');?>