Created
May 18, 2016 11:14
-
-
Save roe3p/5c8157d8bd2052bf0b689a1178d842e0 to your computer and use it in GitHub Desktop.
A5 Language Switching Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//''------------------------- Language Functions | |
function setLanguage(){ | |
var lang = {dialog.object}.appVars.currentLanguage; | |
if(lang == 'English') { | |
A5.msgBox.buttons.cancel = {html: "Cancel"}; | |
A5.msgBox.buttons.yes = {html: "Yes"}; | |
A5.msgBox.buttons.no = {html: "No"}; | |
} else { | |
A5.msgBox.buttons.cancel = {html: "Annuler"}; | |
A5.msgBox.buttons.yes = {html: "Oui"}; | |
A5.msgBox.buttons.no = {html: "Non"}; | |
} | |
//loop through translation array | |
for(var i = 0; i < json_lang_span.length; i++){ | |
//var s = $('_lang_' + json_lang_span[i].Name) | |
//if(s) s.innerHTML = lang == 'French' ? json_lang_span[i].French : json_lang_span[i].English; | |
//debugger; | |
var spans = document.querySelectorAll('[id^=_lang_' + json_lang_span[i].Name + ']') | |
for(j = 0; j < spans.length; j++) { | |
spans[j].innerHTML = lang == 'French' ? json_lang_span[i].French : json_lang_span[i].English; | |
} | |
//debugger; | |
} | |
} | |
function getMessage(msg) { | |
//loop through translation array | |
for(var i = 0; i < json_lang_message.length; i++){ | |
if(json_lang_message[i].Name == msg) { | |
return {dialog.object}.appVars.currentLanguage == 'French' ? | |
json_lang_message[i].French : | |
json_lang_message[i].English; | |
} | |
} | |
} | |
function getTechnicalAreas(){ | |
var arr = [['','']]; | |
for(var i = 1; i < json_technicalarea.length; i++){ | |
if({dialog.object}.appVars.currentLanguage == 'English') { | |
arr.push(['[' + json_technicalarea[i].Code + '] ' + decodeHTML(json_technicalarea[i].Description_EN), json_technicalarea[i].Code]); | |
} else { | |
arr.push(['[' + json_technicalarea[i].Code + '] ' + decodeHTML(json_technicalarea[i].Description_FR), json_technicalarea[i].Code]); | |
} | |
} | |
return arr; | |
} | |
function populateTechnicalAreas(){ | |
var arr = getTechnicalAreas(); | |
{dialog.Object}.populateDropdownBox('TECHNICALAREA',arr,true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment