Pixelmate übersetzen

Ersetzt deutsche Cookie-Banner-Texte per JS, wenn Plugin keine Mehrsprachigkeit unterstützt.


add_action('wp_footer', function() {
    ?>
    <script>
    document.addEventListener('DOMContentLoaded', function() {

        const translations = {
            'Auswahl speichern': 'Save selection', // Texte anpassen
            'Einstellungen löschen': 'Delete settings', // Texte anpassen
            'Cookie Einstellungen': 'Cookie Settings' // Texte anpassen
        };

        const observer = new MutationObserver(function() {
            document.querySelectorAll('button, a, h1, h2, h3, div, span, strong').forEach(function(el) {
                const text = el.textContent.trim();
                if (translations[text]) {
                    el.textContent = translations[text];
                }
            });
        });

        observer.observe(document.body, { childList: true, subtree: true });
    });
    </script>
    <?php
});

Übersetzungen für Pixelmate-Beschreibungstexte


add_action('wp_footer', function() {
    ?>
    <script>
    document.addEventListener('DOMContentLoaded', function() {

        const translations = {
            'YouTube ist eine Videohosting Plattform. Durch die externe Einbindung von Videos werden personenbezogene Daten an YouTube übermittelt.': 
                'YouTube is a video hosting platform. By embedding videos, personal data may be transmitted to YouTube.',

            'Wir haben auf unserer Website interaktive Karten mit Hilfe von Google Maps der Google LLC. („Google“) integriert. Die Karten werden nur angezeigt, wenn Sie dem Setzen und Auslesen von Cookies durch Google zustimmen. Dadurch können personenbezogene Daten an Google übermittelt werden.': 
                'We use interactive maps provided by Google Maps, a service of Google LLC (“Google”). The maps will only be displayed if you consent to the setting and reading of cookies by Google. In doing so, personal data may be transmitted to Google.'
        };

        const observer = new MutationObserver(function() {
            document.querySelectorAll('p, div, span').forEach(function(el) {
                const text = el.textContent.trim();
                if (translations[text]) {
                    el.textContent = translations[text];
                }
            });
        });

        observer.observe(document.body, { childList: true, subtree: true });
    });
    </script>
    <?php
});