feat: initial commit - Phase 1 & 2 core features

This commit is contained in:
hiderfong
2026-04-22 17:07:33 +08:00
commit 1773bda06b
25005 changed files with 6252106 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
import { FieldPath } from "../../utils/typescript.js";
import "../../utils/index.js";
import _default from "../../locale/lang/en.js";
import { Language } from "../../locale/index.js";
import { InjectionKey, Ref } from "vue";
import { MaybeRef } from "@vueuse/core";
//#region ../../packages/hooks/use-locale/index.d.ts
type LocaleKeys = Exclude<FieldPath<typeof _default>, 'name' | 'el'> | (string & NonNullable<unknown>);
type TranslatorOption = Record<string, string | number>;
type Translator = (path: LocaleKeys, option?: TranslatorOption) => string;
type LocaleContext = {
locale: Ref<Language>;
lang: Ref<string>;
t: Translator;
};
declare const buildTranslator: (locale: MaybeRef<Language>) => Translator;
declare const translate: (path: LocaleKeys, option: undefined | TranslatorOption, locale: Language) => string;
declare const buildLocaleContext: (locale: MaybeRef<Language>) => LocaleContext;
declare const localeContextKey: InjectionKey<Ref<Language | undefined>>;
declare const useLocale: (localeOverrides?: Ref<Language | undefined>) => LocaleContext;
//#endregion
export { LocaleContext, LocaleKeys, Translator, TranslatorOption, buildLocaleContext, buildTranslator, localeContextKey, translate, useLocale };