UNPKG

@aplus-frontend/ui

Version:

16 lines (15 loc) 874 B
import { MaybeRef } from '@aplus-frontend/utils'; import { InjectionKey, Ref } from 'vue'; import { LangNames, LocaleType } from '../../locale/interface'; export type TranslatorOption = Record<string, string | number>; export type Translator = (path: string, option?: TranslatorOption) => string; export type LocaleContext = { locale: Ref<LocaleType>; lang: Ref<LangNames>; t: Translator; }; export declare const buildTranslator: (locale: MaybeRef<LocaleType>) => Translator; export declare const translate: (path: string, option: undefined | TranslatorOption, locale: LocaleType) => string; export declare const buildLocaleContext: (locale: MaybeRef<LocaleType>) => LocaleContext; export declare const localeContextKey: InjectionKey<Ref<LocaleType | undefined>>; export declare const useLocale: (localeOverrides?: Ref<LocaleType | undefined>) => LocaleContext;