fix: normalize input text by removing newlines to prevent translation glitches (#1210)

This commit is contained in:
Huang Xin
2025-05-21 11:26:20 +08:00
committed by GitHub
parent 14810d6737
commit b6b8b17760
3 changed files with 36 additions and 41 deletions
@@ -76,7 +76,8 @@ const DeepLPopup: React.FC<DeepLPopupProps> = ({
setTranslation(null);
try {
const result = await translate([text]);
const input = text.replaceAll('\n', ' ').trim();
const result = await translate([input]);
const translatedText = result[0];
const detectedSource = null;