2
0
mirror of https://github.com/frappe/books.git synced 2025-01-23 23:28:24 +00:00

fix: prevent crash on undef language code

This commit is contained in:
18alantom 2022-04-01 16:41:26 +05:30
parent 4c706afe17
commit b8b1cc5a31

View File

@ -526,7 +526,6 @@ async function fetchAndSetLanguageMap(code) {
if (!success) {
showToast({ type: 'error', message });
} else {
window.lm = languageMap;
setLanguageMapOnTranslationString(languageMap);
}
@ -561,11 +560,13 @@ export async function setLanguageMap(initLanguage, dontReload = false) {
function getLanguageCode(initLanguage, oldLanguage) {
let language = initLanguage ?? oldLanguage;
let usingDefault = false;
if (!language) {
language = DEFAULT_LANGUAGE;
usingDefault = true;
}
return [languageCodeMap[language], language, usingDefault];
const code = languageCodeMap[language] ?? 'en';
return [code, language, usingDefault];
}
export function getCOAList() {