mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-12-18 08:27:03 +02:00
Merge pull request #324 from dingedi/main
better display of detected language
This commit is contained in:
commit
9e8bcf6040
@ -228,7 +228,8 @@ document.addEventListener('DOMContentLoaded', function(){
|
|||||||
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 !== undefined){
|
if(self.sourceLang == "auto" && res.detectedLanguage !== undefined){
|
||||||
self.detectedLangText = res.detectedLanguage.language+" ("+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{
|
} else{
|
||||||
throw new Error(res.error || "Unknown error");
|
throw new Error(res.error || "Unknown error");
|
||||||
|
@ -142,7 +142,7 @@
|
|||||||
<div class="row mb-0">
|
<div class="row mb-0">
|
||||||
<div class="col s6 language-select">
|
<div class="col s6 language-select">
|
||||||
<span>Translate from</span>
|
<span>Translate from</span>
|
||||||
<span><i>[[ detectedLangText ]]</i></span>
|
<span v-if="detectedLangText !== ''">[[ detectedLangText ]]</span>
|
||||||
<select class="browser-default" v-model="sourceLang" ref="sourceLangDropdown" @change="handleInput">
|
<select class="browser-default" v-model="sourceLang" ref="sourceLangDropdown" @change="handleInput">
|
||||||
<template v-for="option in langs">
|
<template v-for="option in langs">
|
||||||
<option :value="option.code">[[ option.name ]]</option>
|
<option :value="option.code">[[ option.name ]]</option>
|
||||||
|
Loading…
Reference in New Issue
Block a user