【发布时间】:2018-12-21 02:23:15
【问题描述】:
我想知道是否可以翻译文本中包含 HTML 标记的页面部分。
例子:
<p i18n="@@genericError">
Please Try again or <a href="https://help.companyx.com">get in touch</a> with us for help.
</p>
我的翻译文件如下所示:
<trans-unit id="genericError" datatype="html">
<source>
Please Try again or <x id="START_LINK" ctype="x-a" equiv-text="<a>" />get in touch<x id="CLOSE_LINK" ctype="x-a" equiv-text="</a>" /> with us for help.
</source>
<target>
Por favor tente novamente ou <x id="START_LINK" ctype="x-a" equiv-text="<a>" />entre em contato<x id="CLOSE_LINK" ctype="x-a" equiv-text="</a>" /> conosco.
</target>
</trans-unit>
当我尝试使用 ng serve 运行我的项目时,出现以下错误:
未知占位符 START_LINK 中的错误
我在网上查了一下 (https://github.com/angular/angular/issues/25242),如果我理解正确的话,似乎 HTML 并不打算嵌入到翻译文件中。
你们有什么解决方法吗?
谢谢!
【问题讨论】: