mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: translate funcs
This commit is contained in:
1 parent
fa9b6c6d97
commit
cba93b3d55
3 files changed
+59
-32
No files matched your search
@@ -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>>;
|
||||
Reference in new issue
Block a user