智慧水务管理系统 - 精河县供水工程综合管理平台

index.d.ts 1.1KB

123456789101112131415161718192021
  1. import { FieldPath } from "../../utils/typescript.js";
  2. import _default from "../../locale/lang/en.js";
  3. import { Language } from "../../locale/index.js";
  4. import { InjectionKey, MaybeRef, Ref } from "vue";
  5. //#region ../../packages/hooks/use-locale/index.d.ts
  6. type LocaleKeys = Exclude<FieldPath<typeof _default>, 'name' | 'el'> | (string & NonNullable<unknown>);
  7. type TranslatorOption = Record<string, string | number>;
  8. type Translator = (path: LocaleKeys, option?: TranslatorOption) => string;
  9. type LocaleContext = {
  10. locale: Ref<Language>;
  11. lang: Ref<string>;
  12. t: Translator;
  13. };
  14. declare const buildTranslator: (locale: MaybeRef<Language>) => Translator;
  15. declare const translate: (path: LocaleKeys, option: undefined | TranslatorOption, locale: Language) => string;
  16. declare const buildLocaleContext: (locale: MaybeRef<Language>) => LocaleContext;
  17. declare const localeContextKey: InjectionKey<Ref<Language | undefined>>;
  18. declare const useLocale: (localeOverrides?: Ref<Language | undefined>) => LocaleContext;
  19. //#endregion
  20. export { LocaleContext, LocaleKeys, Translator, TranslatorOption, buildLocaleContext, buildTranslator, localeContextKey, translate, useLocale };