How can I use translations in i18next in javascript
问题 I know that I can use i18next to translate languages in html. For example: <div data-i18n="someKey"></div> But is there a way to somehow use it in JS. For example if I want to do something like alert(someKey) ? 回答1: It should be alert(t(someKey)) (see http://i18next.com/ at end of page). 回答2: Having read the homepage of the project... i18n.init(function(t) { // translate nav $(".nav").i18n(); // programatical access var appName = t("app.name"); }); That last part is what you're looking for.