diff --git a/website/index.html b/website/index.html index e6d1d07..d380cc4 100644 --- a/website/index.html +++ b/website/index.html @@ -18,15 +18,15 @@ @@ -38,23 +38,23 @@
-

Winkelmandje

+

Winkelmandje

Totaal: €0.00

- +
@@ -64,6 +64,8 @@ 0 + +
EN
diff --git a/website/script.js b/website/script.js index 29060a4..1fa123f 100644 --- a/website/script.js +++ b/website/script.js @@ -270,3 +270,56 @@ window.onclick = function(event) { // Initial call to updateCart to ensure the button is hidden on page load updateCart(); + +const translations = { + en: { + "Broodjes": "Sandwiches", + "Koude Dranken": "Cold Drinks", + "Warme Dranken": "Hot Drinks", + "Snacks": "Snacks", + "deserts": "Desserts", + "Deals": "Deals", + "Soepen": "Soups", + "Salades": "Salads", + "Sausjes": "Sauces", + "Winkelmandje": "Shopping Cart", + "Bestellen": "Order", + "Prijs": "Price", + "Toevoegen aan winkelmandje": "Add to Cart", + "Soep van de dag! (Allergieën? Meld het bij ons!)": "Soup of the day! (Allergies? Let us know!)", + // Add more translations as needed + }, + nl: { + "Sandwiches": "Broodjes", + "Cold Drinks": "Koude Dranken", + "Hot Drinks": "Warme Dranken", + "Snacks": "Snacks", + "Desserts": "deserts", + "Deals": "Deals", + "Soups": "Soepen", + "Salads": "Salades", + "Sauces": "Sausjes", + "Shopping Cart": "Winkelmandje", + "Order": "Bestellen", + "Price": "Prijs", + "Add to Cart": "Toevoegen aan winkelmandje", + "Soup of the day! (Allergies? Let us know!)": "Soep van de dag! (Allergieën? Meld het bij ons!)", + // Add more translations as needed + } +}; + +function switchLanguage(lang) { + document.querySelectorAll("[data-translate]").forEach(element => { + const key = element.getAttribute("data-translate"); + element.textContent = translations[lang][key] || key; + }); +} + +document.addEventListener("DOMContentLoaded", () => { + document.getElementById("language-switcher").addEventListener("click", () => { + const currentLang = document.documentElement.lang; + const newLang = currentLang === "nl" ? "en" : "nl"; + document.documentElement.lang = newLang; + switchLanguage(newLang); + }); +}); diff --git a/website/style.css b/website/style.css index b55e01b..19ec913 100644 --- a/website/style.css +++ b/website/style.css @@ -151,7 +151,7 @@ body { display: none; /* Initially hide the cart icon */ position: fixed; top: 80px; /* Move the cart icon down */ - right: 20px; + right: 60px; /* Adjust right position to make space for language switcher */ background-color: #ff6600; color: white; padding: 10px 15px; @@ -313,4 +313,22 @@ body { .logo.hidden { opacity: 0; /* Hide the logo */ visibility: hidden; /* Ensure the logo is not clickable */ +} + +.language-switcher { + position: fixed; + bottom: 20px; /* Position at the bottom */ + left: 20px; /* Position at the left */ + background-color: #ff8c00; + color: white; + padding: 10px 20px; + border-radius: 25px; + cursor: pointer; + font-size: 1em; + transition: all 0.3s ease; + z-index: 1100; /* Ensure it is above other elements */ +} + +.language-switcher:hover { + background-color: #e65c00; } \ No newline at end of file