export const supportedLocales = ['en', 'de'] as const; export type Locale = typeof supportedLocales[number]; export function getInitialLocale(cookieStore: any, _hdrs: any): Locale { const cookie = cookieStore?.get?.('lang')?.value as Locale | undefined; if (cookie && (supportedLocales as readonly string[]).includes(cookie)) return cookie; return 'en'; } export async function getDictionary(locale: Locale) { // Use relative imports to ensure resolution in both server and edge runtimes const common = await import(`../locales/${locale}/common.json`).then((m) => m.default); const home = await import(`../locales/${locale}/home.json`).then((m) => m.default); return { common, home, ...home } as any; }