javascript - i18next is not working -
i'm using phonegap , need i18n support application ended choosing i18next. below sample code,but i18next failing,can me in this? output i'm getting list of links name "nav.home","nav.page1","nav.page2". sample html5 code working in chrome , not in mozilla.
//html code <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript" src="i18next-1.6.3.js" ></script> <script type="text/javascript" src="translation.en.json" ></script> <script type="text/javascript" > $(document).ready(function(){ i18n.init(function(t) { $(".nav").i18n(); var appname = t("app.name"); }); }); </script> </head> <body> <ul class="nav"> <li><a href="#" data-i18n="nav.home"></a></li> <li><a href="#" data-i18n="nav.page1"></a></li> <li><a href="#" data-i18n="nav.page2"></a></li> </ul> </body> </html>
translation.en.js file
{ "app": { "name": "i18next" }, "nav": { "home": "home", "page1": "page one", "page2": "page two" } }
try :
$(document).ready(function(){ $.i18n.init({ lng: 'en' }, function(t) { $(".nav").i18n(); var appname = t("app.name"); }); });
i think missing options dictionnary.
Comments
Post a Comment