From 1e5ff14229d4d956d25c2aeee928eb8a4eff9e25 Mon Sep 17 00:00:00 2001 From: Rico040 <93081680+Rico040@users.noreply.github.com> Date: Fri, 31 May 2024 13:42:23 +1000 Subject: [PATCH] fix(dislate): unable to translate multiline messages --- plugins/dislate/src/api/GTranslate.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/dislate/src/api/GTranslate.ts b/plugins/dislate/src/api/GTranslate.ts index 2b30423..186ab0b 100644 --- a/plugins/dislate/src/api/GTranslate.ts +++ b/plugins/dislate/src/api/GTranslate.ts @@ -19,7 +19,9 @@ const translate = async (text: string, source_lang: string = "auto", target_lang console.log(data) - return { source_lang, text: data.sentences[0].trans } + return { + source_lang, + text: data.sentences.map(s => s.trans).join('') } } catch (e) { throw Error(`Failed to fetch from Google Translate: ${e}`) }