Fixed a mistake in translateHTML.
This commit is contained in:
@@ -316,7 +316,6 @@ export async function translateHTML(html: string, reverse:boolean, charArg:simpl
|
|||||||
let translated = await translate(node.textContent || "", reverse);
|
let translated = await translate(node.textContent || "", reverse);
|
||||||
if (!reprocessDisplayScript) {
|
if (!reprocessDisplayScript) {
|
||||||
node.textContent = translated;
|
node.textContent = translated;
|
||||||
applyMarkdownToNode(node);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,6 +325,12 @@ export async function translateHTML(html: string, reverse:boolean, charArg:simpl
|
|||||||
"editdisplay",
|
"editdisplay",
|
||||||
chatID
|
chatID
|
||||||
);
|
);
|
||||||
|
// If the translation is the same, don't replace the node
|
||||||
|
if (translated == processedTranslated) {
|
||||||
|
node.textContent = processedTranslated;
|
||||||
|
applyMarkdownToNode(node)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Replace the old node with the new one
|
// Replace the old node with the new one
|
||||||
const newNode = document.createElement(
|
const newNode = document.createElement(
|
||||||
|
|||||||
Reference in New Issue
Block a user