fix(trans): use dynamic content
This commit is contained in:
parent
2984ae4e6d
commit
47040057b1
11
src/sus.js
11
src/sus.js
@ -27,7 +27,7 @@ function prepareQuestionnaire() {
|
|||||||
field.className = "field";
|
field.className = "field";
|
||||||
field.id = key;
|
field.id = key;
|
||||||
field.innerHTML = `
|
field.innerHTML = `
|
||||||
<label class="label" data-i18n="${key}"></label>
|
<label class="label" data-i18n="dynamic.${key}"></label>
|
||||||
<p class="control">
|
<p class="control">
|
||||||
<input class="sus-slider" type="range" min="1" max="5" step="1" name=${key} required>
|
<input class="sus-slider" type="range" min="1" max="5" step="1" name=${key} required>
|
||||||
<div class="slider-labels">
|
<div class="slider-labels">
|
||||||
@ -44,7 +44,7 @@ function prepareQuestionnaire() {
|
|||||||
field.classList.add("field");
|
field.classList.add("field");
|
||||||
field.id = key;
|
field.id = key;
|
||||||
field.innerHTML = `
|
field.innerHTML = `
|
||||||
<label class="label" data-i18n="${key}"></label>
|
<label class="label" data-i18n="dynamic.${key}"></label>
|
||||||
<p class="control">
|
<p class="control">
|
||||||
<input class="input" type="text" name=${key}/>
|
<input class="input" type="text" name=${key}/>
|
||||||
</p>
|
</p>
|
||||||
@ -84,10 +84,10 @@ 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", "dynamic.submit-success");
|
||||||
} else {
|
} else {
|
||||||
messageDiv.className = "notification is-danger";
|
messageDiv.className = "notification is-danger";
|
||||||
messageDiv.setAttribute("data-i18n", "submit-error");
|
messageDiv.setAttribute("data-i18n", "dynamic.submit-error");
|
||||||
}
|
}
|
||||||
|
|
||||||
messageDiv.classList.remove("is-hidden");
|
messageDiv.classList.remove("is-hidden");
|
||||||
@ -96,7 +96,8 @@ window.addEventListener('DOMContentLoaded', () => {
|
|||||||
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");
|
messageDiv.removeAttribute("data-i18n");
|
||||||
messageDiv.setAttribute("data-i18n", "network-error");
|
messageDiv.setAttribute("data-i18n", "dynamic.network-error");
|
||||||
|
messageDiv.innerHTML = i18next.t("dada", {"error": error});
|
||||||
let errorP = document.createElement("p");
|
let errorP = document.createElement("p");
|
||||||
errorP.className = "error";
|
errorP.className = "error";
|
||||||
errorP.innerText = error;
|
errorP.innerText = error;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user