I am using the i18next script in my jQuery Mobile page in Cordova/PhoneGap app.
I have the below scripts included in the bottom of HTML page.
<script src="js/jquery-1.8.3.min.js"></script>
<script src="js/jquery.mobile-1.3.2.min.js"></script>
<script src="js/i18next-1.7.1.min.js"></script>
<script src="js/main.js"></script>
The main.js file has some logic which will be included in all pages of my app.
main.js File:
function doBootstrap() {
i18n.init({lng: "en", fallbackLng: 'en'});
var header = "some tags";
header += '<h1>' + i18n.t("app.title") + '</h1>';
// other functions
}
I will be using the script to get the translated values across the page in different sections
The above function is called in Cordova devideready function which is placed beow the above mentioned includes. .
document.addEventListener("deviceready", onDeviceReady, true);
function onDeviceReady() {
doBootstrap();
}
With all the above setup I get the below error in i18next-1.7.1.min.js file.
Uncaught TypeError: Cannot read property 'defaultValue' of undefined
The .json file is present in \locales\en\translation.json and the content of it is below. No error or warning is displayed in console.
{
"app": {
"title": "Title"
}
}
What I am missing with the plugin setup?