Skip to content

Commit

Permalink
fix untranslated
Browse files Browse the repository at this point in the history
  • Loading branch information
jemikanegara committed May 9, 2024
1 parent 75a045c commit eec0b24
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
});

Expand All @@ -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];
}
}
Expand Down

0 comments on commit eec0b24

Please sign in to comment.