forked from mirrors/LibreTranslate
show iso if language name is not found (prevent error)
This commit is contained in:
parent
3072219085
commit
eee2cf2f33
1 changed files with 2 additions and 1 deletions
|
@ -228,7 +228,8 @@ document.addEventListener('DOMContentLoaded', function(){
|
|||
self.loadingTranslation = false;
|
||||
self.output = JSON.stringify(res, null, 4);
|
||||
if(self.sourceLang == "auto" && res.detectedLanguage !== undefined){
|
||||
self.detectedLangText = ": " + self.langs.find(l => l.code === res.detectedLanguage.language).name+" ("+res.detectedLanguage.confidence+"%)";
|
||||
let lang = self.langs.find(l => l.code === res.detectedLanguage.language)
|
||||
self.detectedLangText = ": " + (lang !== undefined ? lang.name : res.detectedLanguage.language) + " (" + res.detectedLanguage.confidence + "%)";
|
||||
}
|
||||
} else{
|
||||
throw new Error(res.error || "Unknown error");
|
||||
|
|
Loading…
Reference in a new issue