mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-21 23:41:01 +00:00
introduce detectedLangText var to store auto-detected lang
This commit is contained in:
parent
36e05596aa
commit
b90d996965
1 changed files with 7 additions and 0 deletions
|
@ -25,6 +25,8 @@ document.addEventListener('DOMContentLoaded', function(){
|
||||||
translatedText: "",
|
translatedText: "",
|
||||||
output: "",
|
output: "",
|
||||||
charactersLimit: -1,
|
charactersLimit: -1,
|
||||||
|
|
||||||
|
detectedLangText: "",
|
||||||
|
|
||||||
copyTextLabel: "Copy text",
|
copyTextLabel: "Copy text",
|
||||||
|
|
||||||
|
@ -189,6 +191,8 @@ document.addEventListener('DOMContentLoaded', function(){
|
||||||
if (this.timeout) clearTimeout(this.timeout);
|
if (this.timeout) clearTimeout(this.timeout);
|
||||||
this.timeout = null;
|
this.timeout = null;
|
||||||
|
|
||||||
|
this.detectedLangText = "";
|
||||||
|
|
||||||
if (this.inputText === ""){
|
if (this.inputText === ""){
|
||||||
this.translatedText = "";
|
this.translatedText = "";
|
||||||
this.output = "";
|
this.output = "";
|
||||||
|
@ -223,6 +227,9 @@ document.addEventListener('DOMContentLoaded', function(){
|
||||||
self.translatedText = res.translatedText;
|
self.translatedText = res.translatedText;
|
||||||
self.loadingTranslation = false;
|
self.loadingTranslation = false;
|
||||||
self.output = JSON.stringify(res, null, 4);
|
self.output = JSON.stringify(res, null, 4);
|
||||||
|
if(self.sourceLang == "auto" && res.detectedLanguage.length > 0){
|
||||||
|
self.detectedLangText = res.detectedLanguage.language+" ("+res.detectedLanguage.confidence+"%)";
|
||||||
|
}
|
||||||
} else{
|
} else{
|
||||||
throw new Error(res.error || "Unknown error");
|
throw new Error(res.error || "Unknown error");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue