【问题标题】:i18next don't work in jqueryi18next 在 jquery 中不起作用
【发布时间】:2015-03-16 17:01:11
【问题描述】:

我正在尝试使用 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。

谢谢!

【问题讨论】:

    标签: javascript jquery node.js i18next


    【解决方案1】:

    您正试图在 jquery 上下文中调用 't'。但它应该在 i18n 上下文中调用。

    var msg = i18n.t(key);

    【讨论】:

    猜你喜欢
    • 2013-08-14
    • 1970-01-01
    • 2015-12-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-19
    • 2012-10-31
    相关资源
    最近更新 更多