我正在将Node.js和ExpressJS与node-Localize(https://github.com/AGROSICA/node-localize)一起用于网站。
我有一个网页,其中包含由多个段落(<p></p>
)分割的传记。
有没有一种方法可以在我的翻译文件中保存和呈现html语法和标签信息?
"Bio" : {
"en-US" : "<p>A first paragraphe of information</p><p>And a second one</p>",
"fr" : "<p>Un premier paragraphe d'information</p><p>Et un deuxième</p>"
}
/*And the html...*/
<%= translate("Bio")%>
因为我不想使用以下语法
"BioParagraphe1" : {
"en-US" : "A first paragraphe of information",
"fr" : "Un premier paragraphe d'information"
},
"BioParagraphe2" : {
"en-US" : "And a second one",
"fr" : "Et un deuxième"
}
/*And the html...*/
<p>
<%= translate("BioParagraphe1")%>
</p>
<p>
<%= translate("BioParagraphe2")%>
</p>
我找到了一个解决方案,我可以使用以下正弦值从字符串中呈现html内容
/*I'm using the "<%-" instead of the "<%=" */
<%- translate("BioParagraphe1")%>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句