Files
homarr/packages/translation/src/lang.ts
homarr-renovate[bot] a9a46024e2 fix(deps): update dependency typescript-eslint to v8 (#896)
* fix(deps): update dependency typescript-eslint to v8

* fix: lint issues

* fix: more lint issues

---------

Co-authored-by: homarr-renovate[bot] <158783068+homarr-renovate[bot]@users.noreply.github.com>
Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
2024-08-01 10:13:12 +02:00

23 lines
770 B
TypeScript

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