0

我正在使用http://jamuhl.github.com/i18next/node/工作正常,但是对于一个我似乎无法解决的问题。

就是这样,我的 /locales/dev/translation.json 中有这个 translation.json 文件

{
  "tzm": "Chapters - Zeitgeist Movement"
  ,"welcome": [
    "<p>The Zeitgeist Movement is an explicitly non-violent, global sustainability advocacy group currently working in over 1000 Regional Chapters across 70 countries.</p>"
    ,"<p>The basic structure of The Movement consists of Chapters, Teams, Projects & Events. Overall, the Chapters are essentially what define the Movement and each Chapter works to not only spread awareness about the roots of our social problems today but also to express the logical, scientific solutions and methods we have at our disposal to update and correct the current social system and create a truly responsible, sustainable, peaceful, global society.</p>"
  ]

在我的刀片模板中,我有以下内容:

div#page
   p=t("welcome")

问题是我得到了 html 标签,查看文档http://i18next.com/pages/sample.html专门设置内部 html:

使用 i18next-node 和显示段落部分的正确方法是什么,我之前的做法是:

  ,"welcome": {
    "p1":"The Zeitgeist Movement is an explicitly non-violent, global sustainability advocacy group currently working in over 1000 Regional Chapters across 70 countries."
    ,"p2":"The basic structure of The Movement consists of Chapters, Teams, Projects & Events. Overall, the Chapters are essentially what define the Movement and each Chapter works to not only spread awareness about the roots of our social problems today but also to express the logical, scientific solutions and methods we have at our disposal to update and correct the current social system and create a truly responsible, sustainable, peaceful, global society."
  }

然后我的 page.blade 模板看起来像:

div#page
   p=t("welcome.p1")
   p=t("welcome.p2")

对于少量数据,这可以正常工作,但是如果您有大量段落,它可能会变得无聊。

4

3 回答 3

0

想知道但不应该是这样吗

div#page
    p!=t("welcome")

至少在玉中设置未转义的内容是这样的。

我会使用 node-blade 提供的降价过滤器来处理纯文本内容。

于 2013-02-11T16:16:48.167 回答
0

我这样做并且它有效,尽管您可以<p>在页面加载时看到初始的,然后显示段落。你可以看到它http://blade.eu01.aws.af.cm/

p(data-i18n="[html]welcome")=t("welcome")
于 2013-02-11T17:48:29.580 回答
0

我看了你的页面。它确实以这种方式添加了两个段落。一个带有 p(data-i18n="...") 和一个带有 p!=t("welcome")。对我来说,这似乎是与刀片模板引擎相关的问题。我会在那里打开一个问题。

于 2013-02-13T07:42:52.160 回答