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];
}
