我使用http://jamuhl.github.com/i18next/node/這工作正常,但對於我似乎無法解決的一個問題如何解決它。i18next段落時使用nodejs
這個生命的是,我有這個translation.json文件在我/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>"
]
在我的刀模板
,我有以下幾點:
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")
,這工程確定,對於小的數據集,但它可以例如,如果你有很多段落,會變得無聊。
當您已經在服務器上設置翻譯內容時,爲什麼要添加data-i8n屬性(僅適用於客戶端翻譯)? – jamuhl 2013-02-12 09:14:20
不應該是'p(data-i18n =「[html] welcome」)!= t(「welcome」)'所以段落標籤不會在服務器端逃脫? – jamuhl 2013-02-12 09:15:16
我試過這個,但我得到兩個段落顯示兩次 – khinester 2013-02-12 21:52:37