AllAi/packages/i18n/server.ts
2025-11-14 21:54:04 +03:00

10 lines
409 B
TypeScript

import { dictionaries, fallbackLocale, Locale, resolveLocale } from "./config";
import type { Dictionary } from "./types";
export type { Dictionary, Locale };
export async function loadDictionary(localeInput: string | Locale): Promise<Dictionary> {
const locale = resolveLocale(typeof localeInput === "string" ? localeInput : localeInput);
return dictionaries[locale] ?? dictionaries[fallbackLocale];
}