+ set en as srcLang if undefined (e.g. 1234)

master
io42630 3 years ago
parent abbf4759f5
commit 1cd51795fb

@ -11,5 +11,5 @@ export async function translate(text: string, targetLang: string): Promise<strin
export async function detect(text: string): Promise<string> {
return translator.detect(text)
.then(([result] : any) => result.language);
.then(([result] : any) => result.language === 'und' ? 'en' : result.language);
}

Loading…
Cancel
Save