Using Select menu with localStorage to Suppot Multilingual
My page contains two componenets:
1) Caption/header: has the text "input"
2) Select menu: has two options (English, German).
I want when I chose one of these langauge, the translation of "input" appears on the header.
a) I created two translation.json files for both langauges and inserted the following :
de-DE:
{
"input":"Eingabetext"
}
en-EN:
{
"input":"Input text"
}
b) I added the even (typeList, value change, run java script) to the select menue:
var selectedValue = this.value;
var data = { 'English': ['English', 'German']};
var dropDown = $('[name=typeList]');
dropDown.html('');
var newData = data[selectedValue];
for(i = 0; i < newData.length; i++) {
dropDown.append('' + newData + '');
}
dropDown.selectmenu('refresh');
My questions (please bear with me):
1) When I test the app it shows English (default). When I select German from the select menue, it changes to 'German' but the header does not change to "Eingabetext"
2) Where in the steps above should I change to store language in localStorage.