From eec0b24f4e6452520e59d05a262ac012cc2fd33a Mon Sep 17 00:00:00 2001 From: Lukas Seyfarth Date: Thu, 9 May 2024 16:30:02 +0800 Subject: [PATCH] fix untranslated --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 540900b..cd6bc70 100644 --- a/index.js +++ b/index.js @@ -139,7 +139,7 @@ function processTextNodes(textNodes = [], language = "", apiKey = "") { // If the translation is not available, cache the original text if ((window.translationCache?.[window.location.pathname]?.[language]?.[text] || "").includes("weploy-untranslated")) { - window.translationCache[window.location.pathname][language][text] = text; + window.translationCache[window.location.pathname][language][text] = undefined; } }); @@ -148,7 +148,7 @@ function processTextNodes(textNodes = [], language = "", apiKey = "") { const text = node.textContent; if(window.translationCache?.[window.location.pathname]?.[language]?.[text]) { // make sure text is still the same before replacing - if(node.textContent == text) { + if(node.textContent == text && !(window.translationCache?.[window.location.pathname]?.[language]?.[text] || "").includes("weploy-untranslated")) { node.textContent = window.translationCache?.[window.location.pathname]?.[language]?.[text]; } }