Reduce the load on language judgment
This commit is contained in:
parent
0976b12982
commit
15f29b1a72
|
@ -55,6 +55,7 @@ async function Select(e) {
|
||||||
//選択テキストの言語をチェックして返す
|
//選択テキストの言語をチェックして返す
|
||||||
async function checkLang(sourceWord, sourceLang, targetLang) {
|
async function checkLang(sourceWord, sourceLang, targetLang) {
|
||||||
if (!S.get().ifCheckLang) return true; //設定がオフならtrue
|
if (!S.get().ifCheckLang) return true; //設定がオフならtrue
|
||||||
|
sourceWord=sourceWord.substr(0, 100); //先頭100字で言語を判定
|
||||||
|
|
||||||
const resultData = await T.translate(sourceWord, sourceLang, targetLang);
|
const resultData = await T.translate(sourceWord, sourceLang, targetLang);
|
||||||
const needTranslate = (S.get().targetLang != resultData.sourceLanguage) && (resultData.percentage > 0);
|
const needTranslate = (S.get().targetLang != resultData.sourceLanguage) && (resultData.percentage > 0);
|
||||||
|
|
Loading…
Reference in a new issue