From 41d96da2466dd072f8a5b0314ddaf1dce98d49d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A1=9C=E8=8F=AF?= Date: Fri, 3 Mar 2023 10:14:11 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E4=B8=AD=E6=96=87=E5=88=B0?= =?UTF-8?q?=E8=8B=B1=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/api/drawing.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/api/drawing.ts b/server/api/drawing.ts index 9ca3a90..7ad6c7d 100644 --- a/server/api/drawing.ts +++ b/server/api/drawing.ts @@ -23,7 +23,7 @@ export default defineEventHandler(async event => { // 翻译中文到英文 const translate = async (text: string, callback:Function) => { - if (/^[a-zA-Z]+$/.test(text)) { + if (/[\u4E00-\u9FA5\uF900-\uFA2D]/.test(text)) { text = encodeURIComponent(text) const {data} = await axios.get(`http://139.224.128.24:7861//api/text_to_text?zh=${text}`) text = data.en