feat: translate funcs

This commit is contained in:
TrèsAbhi committed 2024-03-03 22:13:22 -06:00
1 parent fa9b6c6d97
commit cba93b3d55
3 files changed
+59 -32

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
const LANGUAGES = ['en-US', 'es-ES', 'ja-JP'] as const;
export type Language = (typeof LANGUAGES)[number];
export type TranslationFragmentTree = {
[key: string]: TranslationFragment;
} & {
$?: string;
};
export type TranslationFragment = string | TranslationFragmentTree;
export const translations = LANGUAGES.reduce(
(table, language) => ({
...table,
[language]: import(`../../lang/${language}.json`),
}),
{},
) as Record<Language, Promise<TranslationFragment>>;