import { supportedLanguages } from "./config"; const _enTranslations = () => import("./lang/en.json"); type EnTranslation = typeof _enTranslations; export const createLanguageMapping = () => { const mapping: Record = {}; for (const language of supportedLanguages) { mapping[language] = () => import(`./lang/${language}.json`); } return mapping as Record<(typeof supportedLanguages)[number], () => ReturnType>; }; type NestedKeyOf = { [Key in keyof ObjectType & (string | number)]: ObjectType[Key] extends object ? `${Key}` | `${Key}.${NestedKeyOf}` : `${Key}`; }[keyof ObjectType & (string | number)]; export type TranslationKeys = NestedKeyOf;