I'm using i18next with the plugin https://github.com/i18next/ng-i18next. with the angular directive, it's supposed to display "test" and "this is a test" on the page. But it shows "home.title" and "home.content". checked the console, json files are loaded properly, correct content can be displayed if I use javascript DOM.
my json file:
{
"home":{
"title": "test",
"content": "this is a test"
}
}
html:
<div ng-app="myApp" ng-controller="myCtrl" class="home">
<h1 ng-i18next="home.title"></h1>
<p ng-i18next="home.content"></p>
</div>
script:
angular.module('jm.i18next')
.config(['$i18nextProvider',function($i18nextProvider){
window.i18next.use(window.i18nextXHRBackend);
$i18nextProvider.options = {
debug: true,
lng: 'en',
fallbackLng: 'en',
backend: {
loadPath: '/locales/{{lng}}/{{ns}}.json'
}
};
}]);
angular.module('myApp', ['jm.i18next']).controller('myCtrl',['$scope', '$i18next',function($scope, $i18next){
}])
Here is the info from console, I don't know what the last error is:
- i18next::backendConnector: loaded namespace translation for language en Object {home: Object}
- i18next.min.js:2 i18next: languageChanged en
- i18next.min.js:2 i18next: initialized Object {debug: true, ns: Array[1], defaultNS: Array[1], fallbackLng: Array[1], fallbackNS: falseā¦}
- ng-i18next.min.js:1 Uncaught TypeError: i.lng is not a function