🌐 Add Localization feature

This commit is contained in:
2022-08-21 16:57:06 +02:00
parent 710a07b04b
commit 59a2c0eacb
17 changed files with 301 additions and 123 deletions

View File

@ -1,35 +1,16 @@
import { substitutionTexts } from "./definitions";
import { classFilter } from "./store";
export function getSubstitutionText(substitution) {
var text = "";
const includeClass = !classFilter.value || classFilter.value == "none";
const includeClassValue = includeClass ? "withClass" : "withoutClass";
if (!classFilter.value || classFilter.value == "none") {
text +=
substitution.class.join(", ") +
(substitution.class.length > 1 ? " haben " : " hat ");
}
// TODO: implement more texts
if (substitution.type == "change") {
const change = substitution.change;
if (change.subject) {
text += substitutionTexts.subjectChange + " " + change.subject;
}
if (change.teacher && text == "") {
text += substitutionTexts.teacherChange + " " + change.teacher;
} else if (change.teacher) {
text += " " + substitutionTexts.teacherChangePartial;
text += " " + change.teacher;
}
if (change.room && text == "") {
text += substitutionTexts.roomChange + " " + change.room;
} else if (change.room) {
text += " " + substitutionTexts.roomChangePartial;
text += " " + change.room;
}
return `substitution.text.${includeClassValue}.subjectChange`;
} else if (substitution.type == "cancellation") {
text += substitutionTexts.cancellation;
return `substitution.text.${includeClassValue}.cancellation`;
}
return text;
return "";
}
export function getSubstitutionColor(substitution) {