Add entry label translation system for German-to-English game sheet items

Implemented `translateEntryLabel` helper function with mapping dictionary for translating German game entry labels (spells, potions, locations) to English equivalents. Added language parameter extraction in SheetSection component and applied translation to entry labels based on current language setting. Maintains German as source labels with English translations provided via lookup table.
This commit is contained in:
2026-08-02 10:36:44 +02:00
parent 33a972e502
commit 33caa8f792
2 changed files with 25 additions and 3 deletions
+22
View File
@@ -3,6 +3,28 @@ import React, { createContext, useContext, useEffect, useMemo, useState } from "
const STORAGE_KEY = "hpLanguage";
const LanguageContext = createContext(null);
const entryLabels = {
"Schlaftrunk": "Sleeping Potion",
"Verschwindekabinett": "Vanishing Cabinet",
"Portschlüssel": "Portkey",
"Impedimenta": "Impedimenta",
"Petrificus Totalus": "Petrificus Totalus",
"Alraune": "Mandrake",
"Große Halle": "Great Hall",
"Krankenflügel": "Hospital Wing",
"Raum der Wünsche": "Room of Requirement",
"Klassenzimmer für Zaubertränke": "Potions Classroom",
"Pokalszimmer": "Trophy Room",
"Klassenzimmer für Wahrsagen": "Divination Classroom",
"Eulerei": "Owlery",
"Bibliothek": "Library",
"Verteidigung gegen die dunklen Künste": "Defence Against the Dark Arts",
};
export function translateEntryLabel(label, language) {
return language === "en" ? (entryLabels[label] || label) : label;
}
export const translations = {
de: {
language: "Deutsch",