Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在用';gettext';?_Php_Internationalization_Translation_Gettext - Fatal编程技术网

Php 在用';gettext';?

Php 在用';gettext';?,php,internationalization,translation,gettext,Php,Internationalization,Translation,Gettext,我想知道在使用php gettext函数回显字符串时是否有隐藏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="#"

我想知道在使用php gettext函数回显字符串时是否有隐藏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!'); ?>

没有真正的方法隐藏它们,也无法在翻译后重新插入它们,您可以使用字符位置映射,但在翻译后,html标记的字符长度将发生变化

如果你绝对想避免使用html标签,你可以做的是保留中断,并将其转换为新行(如果Transalator需要的话),然后对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') ?>


);?>

没有真正的方法隐藏它们,也无法在翻译后重新插入它们,您可以使用字符位置映射,但在翻译后,html标记的字符长度将发生变化

如果你绝对想避免使用html标签,你可以做的是保留中断,并将其转换为新行(如果Transalator需要的话),然后对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') ?>


);?>

如果将html存储在变量中,并在必要时从变量中删除_tags(),则不起作用?如果将html存储在变量中,并在必要时从变量中删除_tags(),则不起作用?
<?=_('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') ?>