export function getUserLanguage() {
    return {
        de: "de",
        en: "en",
        fr: "fr",
        es: "es",
        cs: "cs",
        cn: "zh"
    }[(navigator.language || navigator.userLanguage).split("-")[0]] || "de";
}

if (typeof window.tg === 'undefined') {
    window.tg = function(textcode) {
        return document.getElementById(`ed_wp_${textcode}`)?.innerText?.trim();
    };
}

window.array_key_exists = function array_key_exists(key, obj) {
    return obj.hasOwnProperty(key);
}

// Function to log an error when a translation key is missing
window.getLogError = function getLogError(code) {
    console.error(`Translation key missing: ${code}`);
}
