// Client-sicherer Teil von lib/i18n: keine Abhängigkeit auf next/headers // oder die Datenbank, darf daher auch von "use client"-Komponenten // importiert werden. getDictionary()/getLocale() (DB-gestützt) leben // in lib/i18n/index.ts und dürfen nur serverseitig importiert werden. export { DEFAULT_LOCALE, isLocale } from "./locales"; export type { Locale } from "./locales"; export type { Dict } from "./dictionaries"; export const LOCALE_COOKIE = "locale"; /** Platzhalter der Form "{name}" durch vars.name ersetzen. */ export function formatMessage( template: string, vars?: Record ): string { if (!vars) return template; return template.replace(/\{(\w+)\}/g, (match, key) => key in vars ? String(vars[key]) : match ); }