test(mvp0): complete remaining i18n, RBAC, and CRUD coverage

This commit is contained in:
2026-02-11 12:06:27 +01:00
parent 8390689c8d
commit 3b130568e9
8 changed files with 238 additions and 9 deletions

View File

@@ -4,10 +4,7 @@ import { cookies } from "next/headers"
import type { AdminMessages } from "./messages"
import { ADMIN_LOCALE_COOKIE } from "./shared"
export async function resolveAdminLocale(): Promise<AppLocale> {
const cookieStore = await cookies()
const value = cookieStore.get(ADMIN_LOCALE_COOKIE)?.value
export function resolveAdminLocaleFromCookieValue(value: string | undefined): AppLocale {
if (value && isAppLocale(value)) {
return value
}
@@ -15,6 +12,12 @@ export async function resolveAdminLocale(): Promise<AppLocale> {
return defaultLocale
}
export async function resolveAdminLocale(): Promise<AppLocale> {
const cookieStore = await cookies()
const value = cookieStore.get(ADMIN_LOCALE_COOKIE)?.value
return resolveAdminLocaleFromCookieValue(value)
}
export async function getAdminMessages(locale: AppLocale): Promise<AdminMessages> {
return (await import(`../messages/${locale}.json`)).default as AdminMessages
}