forked from FASP-QAT/fasp-core-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetLabelText.js
executable file
·19 lines (19 loc) · 979 Bytes
/
getLabelText.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
* This function is used to display a particular text in the language that is requested by the user
* @param {*} label This is the text that needs to be displayed
* @param {*} lang This is the language in which the text needs to be displayed
* @returns This function returns the text in specified language
*/
export default function getLabelText(label, lang) {
if (lang == 'en') {
return label.label_en;
} else if (lang == 'fr' && label.label_fr != null && label.label_fr != '' && label.label_fr != "NULL" && label.label_fr != "null") {
return label.label_fr;
} else if (lang == 'sp' && label.label_sp != null && label.label_sp != '' && label.label_sp != "NULL" && label.label_sp != "null") {
return label.label_sp;
} else if (lang == 'pr' && label.label_pr != null && label.label_pr != '' && label.label_pr != "NULL" && label.label_pr != "null") {
return label.label_pr;
} else {
return label.label_en;
}
}