i am using http://jamuhl.github.com/i18next/node/ which works fine, but for one issue which i can't seem to figure how to solve it.

that being is that, i have this translation.json file in my /locales/dev/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>"
  ]

in my blade template, i have the following:

div#page
   p=t("welcome")

the problem is that i get the html tags, looking at the documentation http://i18next.com/pages/sample.html specifically setting inner html:

what is the correct way to use i18next-node and display paragraph sections, the way i did it before was like:

  ,"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."
  }

and then my page.blade template would look like:

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

and this works ok, for small sets of data, but it can become boring if you have loads of paragraphs for example.

有帮助吗?

解决方案 3

i did this and it works, although you can see the initial <p>'s on page loads and then the paragraphs display. you can see it http://blade.eu01.aws.af.cm/

p(data-i18n="[html]welcome")=t("welcome")

其他提示

wonder but shouldn't it be like

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

at least in jade it would be like this to set unescaped content.

i would use the markdown filter provided with node-blade for pure text content.

i looked at your page. it really adds two paragraphs this way. one with p(data-i18n="...") and one with p!=t("welcome"). for me this seems to be an issue related with the blade template engine. I would open an issue there.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top