@@ -230,9 +233,9 @@ export default function UserManager() {
{p.full_name || p.email}{" "}
- – {p.email} – {ROLE_LABELS[p.role]}
+ – {p.email} – {roleLabels[p.role]}
- {p.id === me && (du)}
+ {p.id === me && {dict.common.you}}
{p.id !== me && (
)}
diff --git a/components/WeekEditor.tsx b/components/WeekEditor.tsx
index 1ca491e..d8ffaab 100644
--- a/components/WeekEditor.tsx
+++ b/components/WeekEditor.tsx
@@ -11,14 +11,18 @@ import {
formatPrice,
mondayOf,
todayISO,
- WEEKDAYS,
} from "@/lib/menu";
+import { formatMessage } from "@/lib/i18n/shared";
+import { localized } from "@/lib/types";
import type { Dish, MenuEntry, Section } from "@/lib/types";
+import { useDict, useLocale } from "@/components/i18n/LocaleProvider";
export default function WeekEditor({ monday }: { monday: string }) {
const supabase = useMemo(() => createClient(), []);
+ const dict = useDict();
+ const locale = useLocale();
const friday = addDays(monday, 4);
- const days = WEEKDAYS.map((weekday, i) => ({
+ const days = dict.weekdays.long.map((weekday, i) => ({
weekday,
iso: addDays(monday, i),
}));
@@ -42,7 +46,7 @@ export default function WeekEditor({ monday }: { monday: string }) {
supabase
.from("menu_entries")
.select(
- "id, menu_date, section_key, position, dish:dishes(id, name, price, allergens, additives)"
+ "id, menu_date, section_key, position, dish:dishes(id, name, name_en, name_pl, price, allergens, additives)"
)
.gte("menu_date", monday)
.lte("menu_date", friday)
@@ -51,14 +55,14 @@ export default function WeekEditor({ monday }: { monday: string }) {
]);
const problem = se.error ?? di.error ?? en.error;
if (problem) {
- setError(`Laden fehlgeschlagen: ${problem.message}`);
+ setError(formatMessage(dict.weekEditor.loadError, { message: problem.message }));
} else {
setSections(se.data as Section[]);
setDishes(di.data as Dish[]);
setEntries(en.data as unknown as MenuEntry[]);
}
setLoading(false);
- }, [supabase, monday, friday]);
+ }, [supabase, monday, friday, dict]);
useEffect(() => {
setLoading(true);
@@ -75,8 +79,8 @@ export default function WeekEditor({ monday }: { monday: string }) {
if (error) {
setError(
/duplicate key/i.test(error.message)
- ? "Dieses Gericht ist an diesem Tag bereits zugewiesen."
- : `Speichern fehlgeschlagen: ${error.message}`
+ ? dict.weekEditor.duplicateEntry
+ : formatMessage(dict.weekEditor.saveError, { message: error.message })
);
}
setAdding(null);
@@ -86,27 +90,30 @@ export default function WeekEditor({ monday }: { monday: string }) {
async function removeEntry(id: string) {
const { error } = await supabase.from("menu_entries").delete().eq("id", id);
- if (error) setError(`Löschen fehlgeschlagen: ${error.message}`);
+ if (error)
+ setError(formatMessage(dict.weekEditor.deleteError, { message: error.message }));
await load();
}
+ const [hintBefore, hintAfter] = dict.weekEditor.newDishesHint.split("{link}");
+
return (
- Wochenplan
+ {dict.weekEditor.title}
- ← Vorherige Woche
+ {dict.publicMenu.prevWeek}
- Heute
+ {dict.publicMenu.today}
- Nächste Woche →
+ {dict.publicMenu.nextWeek}
@@ -116,7 +123,7 @@ export default function WeekEditor({ monday }: { monday: string }) {
)}
{loading ? (
-
Lade Wochenplan…
+
{dict.weekEditor.loading}
) : (
@@ -126,7 +133,7 @@ export default function WeekEditor({ monday }: { monday: string }) {
{d.weekday}
- {formatDateLong(d.iso)}
+ {formatDateLong(d.iso, dict.dateLocale)}
|
))}
@@ -135,7 +142,7 @@ export default function WeekEditor({ monday }: { monday: string }) {
{sections.map((s) => (
|
- {s.label}
+ {localized(s, locale)}
{s.time_range}
|
{days.map((d) => {
@@ -146,21 +153,23 @@ export default function WeekEditor({ monday }: { monday: string }) {
{entriesFor(entries, d.iso, s.key).map((e) => {
const codes = dishCodes(e.dish);
return (
-
-
{e.dish.name}
- {codes &&
{codes}}
- {" – "}
- {formatPrice(e.dish.price)}
-
-
+
+
+ {localized(e.dish, locale)}
+
+ {codes &&
{codes}}
+ {" – "}
+ {formatPrice(e.dish.price)}
+
+
+
-
);
})}
{isAdding ? (
@@ -170,10 +179,10 @@ export default function WeekEditor({ monday }: { monday: string }) {
value={selectedDish}
onChange={(e) => setSelectedDish(e.target.value)}
>
-
+
{dishes.map((dish) => (
))}
@@ -184,7 +193,7 @@ export default function WeekEditor({ monday }: { monday: string }) {
onClick={addEntry}
disabled={!selectedDish}
>
- Hinzufügen
+ {dict.common.add}
@@ -207,7 +216,7 @@ export default function WeekEditor({ monday }: { monday: string }) {
setSelectedDish("");
}}
>
- Mahlzeit hinzufügen
+ {dict.weekEditor.addMeal}
)}
@@ -219,11 +228,11 @@ export default function WeekEditor({ monday }: { monday: string }) {
)}
- Neue Gerichte legst du unter{" "}
+ {hintBefore}
- Gerichte
- {" "}
- an.
+ {dict.weekEditor.newDishesLinkLabel}
+
+ {hintAfter}
);
diff --git a/lib/menu.ts b/lib/menu.ts
index c417dbb..9cc49fb 100644
--- a/lib/menu.ts
+++ b/lib/menu.ts
@@ -44,12 +44,9 @@ export function weekdayIndex(iso: string): number {
return day <= 4 ? day : -1;
}
-export const WEEKDAYS = ["Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag"];
-export const WEEKDAYS_SHORT = ["Mo", "Di", "Mi", "Do", "Fr"];
-
-/** z. B. "13. Juli 2026" */
-export function formatDateLong(iso: string): string {
- return toDate(iso).toLocaleDateString("de-DE", {
+/** z. B. "13. Juli 2026" (dateLocale z. B. "de-DE", "en-GB", "pl-PL") */
+export function formatDateLong(iso: string, dateLocale: string): string {
+ return toDate(iso).toLocaleDateString(dateLocale, {
day: "numeric",
month: "long",
year: "numeric",