1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| var lg_en = {
"Title": "Translation example",
"Intro": "Hello I am Dende, I am 500 years old.",
"Startpage": {
"TranslationSections": "Hello World",
"TranslationsSubSections" :{
"TitleOne" : "Hello All",
"TitleTwo" : "Hello You",
"TitleTree" : "Hello Me"
}
},
"Aboutpage": {
"TranslationSections": "We are letsboot"
}
};
var lg_fr = {
"Title": "Traduction exemple",
"Intro": "Salut je suis Dende, j'ai 500 ans.",
"Startpage": {
"TranslationSections": "Bonjour le Monde",
"TranslationsSubSections" :{
"TitleOne" : "Salut à tous",
"TitleTwo" : "Salut toi",
"TitleTree" : "Salut moi"
}
},
"Aboutpage": {
"TranslationSections": "Nous somes ..."
}
};
var lg_es = {
"Title": "Traduçion exempo",
"Intro": "Holla me gusto Dende, me 500 anos.",
"Startpage": {
"TranslationSections": "Holla el mundo",
"TranslationsSubSections" :{
"TitleOne" : "Hollas",
"TitleTwo" : "Holla tu",
"TitleTree" : "Hola me"
}
},
"Aboutpage": {
"TranslationSections": "Vamos a la playa ..."
}
};
$('#lg').change(function(){
var obj = `lg_` + $(this).val();
var data = $(window[obj])[0];
$('#Title').text(data.Title);
$('#Intro').text(data.Intro);
$('#TranslationSections').text(data.Startpage.TranslationSections);
$('#TitleOne').text(data.Startpage.TranslationSections.TranslationsSubSections.TitleOne);
$('#TitleTwo').text(data.Startpage.TranslationSections.TranslationsSubSections.TitleTwo);
$('#TitleTree').text(data.Startpage.TranslationSections.TranslationsSubSections.TitleTree);
}); |
Partager