Skip to content

Commit

Permalink
fix(dislate): unable to translate multiline messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Rico040 committed May 31, 2024
1 parent 14974c5 commit 1e5ff14
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/dislate/src/api/GTranslate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
}
Expand Down

0 comments on commit 1e5ff14

Please sign in to comment.