import { supportedLanguages } from "."; const _enTranslations = () => import("./lang/en"); type EnTranslation = typeof _enTranslations; export const languageMapping = () => { const mapping: Record = {}; for (const language of supportedLanguages) { mapping[language] = () => import(`./lang/${language}`) as ReturnType; } 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;