✨ 🌐 Add Localization feature
This commit is contained in:
31
src/util.js
31
src/util.js
@ -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) {
|
||||
|
Reference in New Issue
Block a user