diff --git a/src/apis/index.js b/src/apis/index.js index d8bb923..3c84d3f 100644 --- a/src/apis/index.js +++ b/src/apis/index.js @@ -111,11 +111,15 @@ export const apiTranslate = async ({ let trText = ""; let isSame = false; + if (!text) { + return [trText, true]; + } + const from = OPT_LANGS_SPECIAL[translator].get(fromLang) ?? OPT_LANGS_SPECIAL[translator].get("auto"); const to = OPT_LANGS_SPECIAL[translator].get(toLang); - if (!text || !to) { + if (!to) { console.log(`[trans] target lang: ${toLang} not support`); return [trText, isSame]; }