Skip to content

Commit

Permalink
Merge pull request #16 from tolerious/fix/translation-content
Browse files Browse the repository at this point in the history
πŸ› Fix translation content not correct.
  • Loading branch information
tolerious authored Sep 22, 2024
2 parents 040161b + 1924473 commit 3216f2b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ router.post("/translation/content/", async function (req, res, next) {
res.json(generateBadResponse());
return;
}
const textToBeTranslated = word.replaceAll("&", "");
const textToBeTranslated = word
.replaceAll("&", "")
.replaceAll("\r", "")
.replaceAll("\n", " ");
console.log(`Original content: ${textToBeTranslated}`);
const url = `https://dict.youdao.com/result?word=${textToBeTranslated}&lang=en`;
let dicList = [];
const a = await axios(url);
Expand Down

0 comments on commit 3216f2b

Please sign in to comment.