我正在使用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>
我找到了一个解决方案,我能够使用以下sintax
从字符串中渲染我的html内容/*I'm using the "<%-" instead of the "<%=" */
<%- translate("BioParagraphe1")%>