fix(trans): i hate it

This commit is contained in:
moanos [he/him] 2025-04-17 22:48:28 +02:00
parent 4fbc47ad8c
commit 8f6a28a33e

View File

@ -85,11 +85,9 @@ window.addEventListener('DOMContentLoaded', () => {
if (response.ok) { if (response.ok) {
messageDiv.className = "notification is-success"; messageDiv.className = "notification is-success";
messageDiv.setAttribute("data-i18n", "submit-success"); messageDiv.setAttribute("data-i18n", "submit-success");
messageDiv.textContent = i18next.t("Survey submitted successfully!");
} else { } else {
messageDiv.className = "notification is-danger"; messageDiv.className = "notification is-danger";
messageDiv.setAttribute("data-i18n", "submit-error"); messageDiv.setAttribute("data-i18n", "submit-error");
messageDiv.textContent = i18next.t("There was an error submitting the survey.");
} }
messageDiv.classList.remove("is-hidden"); messageDiv.classList.remove("is-hidden");
@ -97,8 +95,12 @@ window.addEventListener('DOMContentLoaded', () => {
} catch (error) { } catch (error) {
const messageDiv = document.getElementById("response-message"); const messageDiv = document.getElementById("response-message");
messageDiv.className = "notification is-danger"; messageDiv.className = "notification is-danger";
messageDiv.removeAttribute("data-i18n"); // For dynamic error message messageDiv.removeAttribute("data-i18n");
messageDiv.textContent = i18next.t("Network error: {{errorMessage}}",{"errorMessage": error.message}); messageDiv.setAttribute("data-i18n", "network-error");
let errorP = document.createElement("p");
errorP.className = "error";
errorP.innerText = error;
messageDiv.appendChild(errorP);
messageDiv.classList.remove("is-hidden"); messageDiv.classList.remove("is-hidden");
} }
}); });