i18n: migrate from German-first to English-first default locale

Switch defaultLocale from "de" to "en" and make English the code-level
language throughout. All ~145 hardcoded German strings translated:

- API error messages (52 routes) now return English
- Zod validation messages in English
- Classification/analytics functions return English categories
- Notification type labels in English
- Component strings use i18n t() calls (heatmap, mood chart,
  medication form, intake history, password strength, insights card)
- ~50 new i18n keys in both de.json and en.json

Route migration:
- /stimmung → /mood, /zielwerte → /targets (new pages)
- 301 redirects in proxy.ts for legacy URLs
- Sidebar + bottom nav updated

Bump version to 1.0.1.
This commit is contained in:
Marc-André Bombeck committed 2026-03-12 21:31:48 +01:00
1 parent 38309932f3
commit 0c0c345e82
74 files changed
+871 -402

No files matched your search

+3 -3
View File
@@ -20,12 +20,12 @@ export const DELETE = apiHandler(async (request: NextRequest) => {
const body = await request.json();
confirm = typeof body?.confirm === "string" ? body.confirm : "";
} catch {
return apiError("Ungueltige Anfrage", 422);
return apiError("Invalid request", 422);
}
if (confirm !== "DELETE_ACCOUNT") {
return apiError(
"Bestaetigung fehlt. Sende { confirm: 'DELETE_ACCOUNT' }",
"Confirmation missing. Send { confirm: 'DELETE_ACCOUNT' }",
422,
);
}
@@ -35,7 +35,7 @@ export const DELETE = apiHandler(async (request: NextRequest) => {
const adminCount = await prisma.user.count({ where: { role: "ADMIN" } });
if (adminCount <= 1) {
return apiError(
"Der letzte Admin-Account kann nicht geloescht werden",
"The last admin account cannot be deleted",
400,
);
}
+2 -2
View File
@@ -18,11 +18,11 @@ export const DELETE = apiHandler(async (request: NextRequest) => {
const body = await request.json();
confirm = typeof body?.confirm === "string" ? body.confirm : "";
} catch {
return apiError("Ungueltige Anfrage", 422);
return apiError("Invalid request", 422);
}
if (confirm !== "DELETE") {
return apiError("Bestaetigung fehlt", 422);
return apiError("Confirmation missing", 422);
}
const userId = user.id;
+1 -1
View File
@@ -21,7 +21,7 @@ export const PUT = apiHandler(async (request: NextRequest) => {
const parsed = moodLogCredentialsSchema.safeParse(body);
if (!parsed.success) {
return apiError("Ungueltige Eingabe", 422);
return apiError("Invalid input", 422);
}
const { url, apiKey } = parsed.data;
+2 -2
View File
@@ -51,13 +51,13 @@ export const PUT = apiHandler(async (request: NextRequest) => {
if (jsonError) return jsonError;
const parsed = ntfySettingsSchema.safeParse(body);
if (!parsed.success) return apiError("Ungueltige Daten", 422);
if (!parsed.success) return apiError("Invalid data", 422);
const { serverUrl, topic, authToken, enabled } = parsed.data;
if (enabled && (!serverUrl || !topic)) {
return apiError(
"Server-URL und Topic sind erforderlich, wenn ntfy aktiviert ist",
"Server URL and topic are required when ntfy is enabled",
422,
);
}
+5 -5
View File
@@ -15,7 +15,7 @@ export const POST = apiHandler(async () => {
const rl = await checkRateLimit(`ntfy-test:${user.id}`, 5, 5 * 60 * 1000);
if (!rl.allowed) {
return apiError("Maximal 5 Tests in 5 Minuten", 429);
return apiError("Maximum 5 tests in 5 minutes", 429);
}
const channel = await prisma.notificationChannel.findUnique({
@@ -25,13 +25,13 @@ export const POST = apiHandler(async () => {
});
if (!channel) {
return apiError("ntfy ist nicht konfiguriert", 400);
return apiError("ntfy is not configured", 400);
}
const config = JSON.parse(decrypt(channel.config)) as NtfyChannelConfig;
if (!config.serverUrl || !config.topic) {
return apiError("Server-URL und Topic sind erforderlich", 400);
return apiError("Server URL and topic are required", 400);
}
const success = await sendViaNtfy(config, {
@@ -39,11 +39,11 @@ export const POST = apiHandler(async () => {
userId: user.id,
title: "HealthLog Test",
message:
"HealthLog: Verbindung erfolgreich! ntfy-Benachrichtigungen sind aktiv.",
"HealthLog: Connection successful! ntfy notifications are active.",
});
if (!success) {
return apiError("Testnachricht konnte nicht gesendet werden", 500);
return apiError("Failed to send test message", 500);
}
annotate({ action: { name: "settings.ntfy.test" }, meta: { success: true } });
+9 -9
View File
@@ -47,14 +47,14 @@ export const PUT = apiHandler(async (request: NextRequest) => {
telegramEnabled: true,
},
});
if (!current) return apiError("Benutzer nicht gefunden", 404);
if (!current) return apiError("User not found", 404);
const { data: body, error: jsonError } = await safeJson(request);
if (jsonError) return jsonError;
const result = z.safeParse(telegramSettingsSchema, body);
if (!result.success) {
return apiError("Ungueltige Eingabe", 422);
return apiError("Invalid input", 422);
}
const { botToken, chatId, enabled } = result.data;
@@ -68,7 +68,7 @@ export const PUT = apiHandler(async (request: NextRequest) => {
if (enabled && (!hasTokenAfter || !hasChatIdAfter)) {
return apiError(
"Fuer aktiviertes Telegram werden Bot-Token und Chat-ID benoetigt",
"Bot token and chat ID are required when Telegram is enabled",
422,
);
}
@@ -82,7 +82,7 @@ export const PUT = apiHandler(async (request: NextRequest) => {
const appUrl = process.env.APP_URL ?? process.env.NEXT_PUBLIC_APP_URL;
if (!appUrl) {
return apiError(
"Server-Konfiguration fehlerhaft: APP_URL (oder NEXT_PUBLIC_APP_URL) fehlt.",
"Server configuration error: APP_URL (or NEXT_PUBLIC_APP_URL) is missing.",
500,
);
}
@@ -92,14 +92,14 @@ export const PUT = apiHandler(async (request: NextRequest) => {
appBaseUrl = new URL(appUrl);
} catch {
return apiError(
"Server-Konfiguration fehlerhaft: APP_URL ist ungueltig.",
"Server configuration error: APP_URL is invalid.",
500,
);
}
if (appBaseUrl.protocol !== "https:") {
return apiError(
"Telegram-Webhook benoetigt eine oeffentliche HTTPS-URL (kein http/localhost).",
"Telegram webhook requires a public HTTPS URL (no http/localhost).",
422,
);
}
@@ -107,7 +107,7 @@ export const PUT = apiHandler(async (request: NextRequest) => {
const localHosts = new Set(["localhost", "127.0.0.1", "::1"]);
if (localHosts.has(appBaseUrl.hostname.toLowerCase())) {
return apiError(
"Telegram-Webhook benoetigt eine oeffentlich erreichbare Domain (localhost ist nicht erlaubt).",
"Telegram webhook requires a publicly reachable domain (localhost is not allowed).",
422,
);
}
@@ -117,7 +117,7 @@ export const PUT = apiHandler(async (request: NextRequest) => {
!["80", "88", "443", "8443"].includes(appBaseUrl.port)
) {
return apiError(
"Telegram-Webhook erlaubt nur die Ports 80, 88, 443 oder 8443.",
"Telegram webhook only allows ports 80, 88, 443, or 8443.",
422,
);
}
@@ -131,7 +131,7 @@ export const PUT = apiHandler(async (request: NextRequest) => {
);
if (!ok) {
return apiError(
"Telegram-Webhook konnte nicht gesetzt werden. Pruefe Bot-Token und Erreichbarkeit.",
"Failed to set Telegram webhook. Check bot token and reachability.",
422,
);
}
+4 -4
View File
@@ -14,7 +14,7 @@ export const POST = apiHandler(async () => {
const rl = await checkRateLimit(`telegram-test:${user.id}`, 5, 5 * 60 * 1000);
if (!rl.allowed) {
return apiError("Maximal 5 Tests in 5 Minuten", 429);
return apiError("Maximum 5 tests in 5 minutes", 429);
}
const dbUser = await prisma.user.findUnique({
@@ -24,7 +24,7 @@ export const POST = apiHandler(async () => {
if (!dbUser?.telegramBotToken || !dbUser?.telegramChatId) {
return apiError(
"Bot-Token und Chat-ID muessen zuerst gespeichert werden",
"Bot token and chat ID must be saved first",
422,
);
}
@@ -33,12 +33,12 @@ export const POST = apiHandler(async () => {
const ok = await sendTelegramMessage(
botToken,
dbUser.telegramChatId,
"HealthLog: Verbindung erfolgreich! Telegram-Benachrichtigungen sind aktiv.",
"HealthLog: Connection successful! Telegram notifications are active.",
);
if (!ok) {
return apiError(
"Nachricht konnte nicht gesendet werden. Pruefe Bot-Token und Chat-ID.",
"Failed to send message. Check bot token and chat ID.",
422,
);
}