我正在尝试使用 i18next 翻译 jQuery 中的消息,但是 不工作。
index.js:
========
jQuery(document).ready(function($){
var msg = $.t("index.info")
}
translation.json:
================
"index": {
"info": "The Information"
}
app.js:
=======
i18n.init ({saveMissing: true,
debug: true,
sendMissingTo: 'fallback'
}
);
i18n.registerAppHelper (app)
.serveClientScript (app)
.serveDynamicResources(app)
.serveMissingKeyRoute (app);
我需要在 jQuery 中使用 i18next。
谢谢!
最佳答案
您正在尝试在 jquery 上下文中调用“t”。但它应该在 i18n 上下文中调用。
var msg = i18n.t(key);
关于javascript - i18next 在 jquery 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28011934/