document.addEventListener(“DOMContentLoaded”, function() {
// 1. Master Translation Matrix for Buttons, Widgets, and Your Exact Categories
const translationMap = {
/* Core Categories Visible on Your Screen */
“Books”: “Spirituelle Schriften”,
“Incense, Powders, & Resin”: “Räucherwerk, Pulver & Harze”,
“Sachets”: “Energetisierte Sachets”,
“Spirit Jewelry”: “Ritueller Schutzschmuck”,
“Spiritual oil”: “Spirituelle Altar-Öle”,
“Uncategorized”: “Nicht kategorisiert”,

/* Widget Headers & Layout Controls */
“SEARCH PRODUCT”: “PRODUKT SUCHEN”,
“BROWSE”: “KATEGORIEN”,
“FILTER BY PRICE”: “NACH PREIS FILTERN”,
“FILTER”: “FILTERN”,
“RECENTLY VIEWED”: “ZULETZT ANGESEHEN”,
“Add to cart”: “In den Warenkorb”,
“Add to wishlist”: “Auf Wunschliste”,
“Quick View”: “Schnellansicht”
};

// 2. DOM Replacement Engine
function translateShopElements() {
// Targets text elements, link menus, list items, and headings
const textElements = document.querySelectorAll(‘span, a, button, h1, h2, h3, h4, h5, p, li, div, input[type=”submit”]’);

textElements.forEach(element => {
let text = element.textContent ? element.textContent.trim() : ”;
if (translationMap[text]) {
element.textContent = translationMap[text];
}

// Check placeholders inside your search boxes
if (element.tagName === ‘INPUT’ && element.getAttribute(‘placeholder’)) {
let placeholderText = element.getAttribute(‘placeholder’).trim();
if (translationMap[placeholderText]) {
element.setAttribute(‘placeholder’, translationMap[placeholderText]);
}
}
});
}

// 3. Dynamic Observer Loop (Keeps elements translated during filter actions)
translateShopElements();

const observer = new MutationObserver(function(mutations) {
translateShopElements();
});

observer.observe(document.body, {
childList: true,
subtree: true
});
});

<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function() {
    // 1. Fixed Translation Dictionary Matrix
    const translationMap = {
        "Books": "Spirituelle Schriften",
        "Incense, Powders, & Resin": "Räucherwerk, Pulver & Harze",
        "Sachets": "Energetisierte Sachets",
        "Spirit Jewelry": "Ritueller Schutzschmuck",
        "Spiritual oil": "Spirituelle Altar-Öle",
        "Uncategorized": "Nicht kategorisiert",
        "SEARCH PRODUCT": "PRODUKT SUCHEN",
        "BROWSE": "KATEGORIEN",
        "FILTER BY PRICE": "NACH PREIS FILTERN",
        "FILTER": "FILTERN",
        "RECENTLY VIEWED": "ZULETZT ANGESEHEN",
        "Add to cart": "In den Warenkorb",
        "Add to wishlist": "Auf Wunschliste",
        "Quick View": "Schnellansicht"
    };

    // 2. Safe DOM Structural Text Node Replacer Engine
    function translateShopElements() {
        const textElements = document.querySelectorAll('span, a, button, h1, h2, h3, h4, h5, p, li, div, input[type="submit"]');
        
        textElements.forEach(element => {
            let text = element.textContent ? element.textContent.trim() : '';
            if (translationMap[text]) {
                element.textContent = translationMap[text];
            }
            
            if (element.tagName === 'INPUT' && element.getAttribute('placeholder')) {
                let placeholderText = element.getAttribute('placeholder').trim();
                if (translationMap[placeholderText]) {
                    element.setAttribute('placeholder', translationMap[placeholderText]);
                }
            }
        });
    }

    // 3. Execution Loops & Observer System
    translateShopElements();
    
    const observer = new MutationObserver(function(mutations) {
        translateShopElements();
    });
    
    observer.observe(document.body, {
        childList: true,
        subtree: true
    });
});
</script>