{ "version": 3, "sources": ["../../js/translate.js"], "sourcesContent": ["let currentLanguage = 'de'; // Default language\n\nfunction loadTranslations() {\n fetch(`translations/${currentLanguage}.json`)\n .then(response => {\n if (!response.ok) {\n throw new Error(`Translation file not found: ${currentLanguage}.json`);\n }\n return response.json();\n })\n .then(data => {\n // Loop through all elements with a data-translate attribute\n const translatableElements = document.querySelectorAll('[data-translate]');\n translatableElements.forEach(element => {\n const key = element.getAttribute('data-translate');\n if (data[key]) {\n // If element has the data-translate-html attribute, use innerHTML.\n if (element.hasAttribute('data-translate-html')) {\n element.innerHTML = data[key];\n } else {\n element.innerText = data[key];\n }\n }\n });\n })\n .catch(error => {\n console.error('Error loading translation:', error);\n alert('Failed to load translations. Please check the console for more details.');\n });\n}\n\nfunction setLanguage(language) {\n currentLanguage = language;\n loadTranslations();\n}\n\n// Initial load\nloadTranslations();\n\n// Bring it to global scope\nwindow.setLanguage = setLanguage;\n"], "mappings": "MAAA,IAAIA,EAAkB,KAEtB,SAASC,GAAmB,CACxB,MAAM,gBAAgBD,CAAe,OAAO,EACvC,KAAKE,GAAY,CACd,GAAI,CAACA,EAAS,GACV,MAAM,IAAI,MAAM,+BAA+BF,CAAe,OAAO,EAEzE,OAAOE,EAAS,KAAK,CACzB,CAAC,EACA,KAAKC,GAAQ,CAEmB,SAAS,iBAAiB,kBAAkB,EACpD,QAAQC,GAAW,CACpC,IAAMC,EAAMD,EAAQ,aAAa,gBAAgB,EAC7CD,EAAKE,CAAG,IAEJD,EAAQ,aAAa,qBAAqB,EAC1CA,EAAQ,UAAYD,EAAKE,CAAG,EAE5BD,EAAQ,UAAYD,EAAKE,CAAG,EAGxC,CAAC,CACL,CAAC,EACA,MAAMC,GAAS,CACZ,QAAQ,MAAM,6BAA8BA,CAAK,EACjD,MAAM,yEAAyE,CACnF,CAAC,CACT,CAEA,SAASC,EAAYC,EAAU,CAC3BR,EAAkBQ,EAClBP,EAAiB,CACrB,CAGAA,EAAiB,EAGjB,OAAO,YAAcM", "names": ["currentLanguage", "loadTranslations", "response", "data", "element", "key", "error", "setLanguage", "language"] }