Basis: Certvia dev@a48c5fb als Fundament für Craftvia
CI / build-and-check (push) Canceled after 0s
CI / audit (push) Canceled after 0s
CI / sbom (push) Canceled after 0s

Unveränderter Stand von certvia/dev (a48c5fb) plus Craftvia-Spezifikation
und Brandbook unter docs/craftvia/. ISMS-Module werden im Folgecommit entfernt.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-14 11:05:39 +02:00
co-authored by Claude Opus 5
commit c8e6f30a27
720 changed files with 140143 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
import { getRequestConfig } from "next-intl/server";
import { auth } from "@/server/auth";
import { prisma } from "@/server/db";
/**
* i18n (SPEC §7): alle UI-Strings kommen aus dem Message-Katalog.
*
* Die UI-Sprache ist eine PERSÖNLICHE Präferenz und lebt an der globalen
* `Identity` (Option C, `uiLocale`) — sie folgt der Person über alle Mandanten.
* Getrennt von `TenantSettings.locale` (= Vorlagen-Import-Sprache des Inhalts).
*
* Robust: auf Login-/Session-losen Seiten (oder wenn die Session keinen
* Identity-Kontext trägt, z. B. reine Plattform-Sessions) fällt die Sprache auf
* `de` zurück. Fehler bei der Auflösung dürfen das Rendering nie brechen.
*/
const SUPPORTED = new Set(["de", "en"]);
export default getRequestConfig(async () => {
let locale = "de";
try {
const session = await auth();
const identityId = session?.user?.identityId;
if (identityId) {
const identity = await prisma.identity.findUnique({
where: { id: identityId },
select: { uiLocale: true },
});
if (identity?.uiLocale && SUPPORTED.has(identity.uiLocale)) locale = identity.uiLocale;
}
} catch {
locale = "de";
}
return {
locale,
messages: (await import(`../../messages/${locale}.json`)).default,
};
});