From bf1d7e6252b0dc03edf139481b5e503563d04017 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 15 Aug 2021 21:52:58 +0900 Subject: [PATCH] =?UTF-8?q?fix(server):=20ja-JP=E3=81=AE=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AA=E5=BD=A2=E5=BC=8F=E3=81=ABDeepL=E3=81=8C=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C=E3=81=97=E3=81=A6=E3=81=AA=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/api/endpoints/notes/translate.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server/api/endpoints/notes/translate.ts b/src/server/api/endpoints/notes/translate.ts index bbc11274a..67c02432c 100644 --- a/src/server/api/endpoints/notes/translate.ts +++ b/src/server/api/endpoints/notes/translate.ts @@ -53,10 +53,13 @@ export default define(meta, async (ps, user) => { return 204; // TODO: 良い感じのエラー返す } + let targetLang = ps.targetLang; + if (targetLang.includes('-')) targetLang = targetLang.split('-')[0]; + const params = new URLSearchParams(); params.append('auth_key', instance.deeplAuthKey); params.append('text', note.text); - params.append('target_lang', ps.targetLang); + params.append('target_lang', targetLang); const res = await fetch('https://api-free.deepl.com/v2/translate', { method: 'POST',