i18next不工作在jQuery中

我试图翻译与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);