index.d.ts 852 B

123456789101112131415
  1. import type { MaybeRef } from '@vueuse/core';
  2. import type { InjectionKey, Ref } from 'vue';
  3. import type { Language } from 'element-plus/es/locale';
  4. export type TranslatorOption = Record<string, string | number>;
  5. export type Translator = (path: string, option?: TranslatorOption) => string;
  6. export type LocaleContext = {
  7. locale: Ref<Language>;
  8. lang: Ref<string>;
  9. t: Translator;
  10. };
  11. export declare const buildTranslator: (locale: MaybeRef<Language>) => Translator;
  12. export declare const translate: (path: string, option: undefined | TranslatorOption, locale: Language) => string;
  13. export declare const buildLocaleContext: (locale: MaybeRef<Language>) => LocaleContext;
  14. export declare const localeContextKey: InjectionKey<Ref<Language | undefined>>;
  15. export declare const useLocale: (localeOverrides?: Ref<Language | undefined>) => LocaleContext;