import 'server-only';

const dictionaries: Record<string, () => Promise<any>> = {
  tr: () => import('../dictionaries/tr.json').then((module) => module.default),
  en: () => import('../dictionaries/en.json').then((module) => module.default),
};

export const getDictionary = async (locale: string) => {
  if (typeof dictionaries[locale] === 'function') {
    return dictionaries[locale]();
  }
  return dictionaries['tr'](); // fallback
};
