import * as vue from 'vue'; import { ObjectDirective, UnwrapRef, WritableComputedRef, App } from 'vue'; import { IJsExtractorOptions } from 'gettext-extractor/dist/js/extractors/common'; /** * Translate content according to the current language. * @deprecated */ declare const Component: vue.DefineComponent<{ tag: { type: StringConstructor; default: string; }; translateN: { type: NumberConstructor; default: null; }; translatePlural: { type: StringConstructor; default: null; }; translateContext: { type: StringConstructor; default: null; }; translateParams: { type: ObjectConstructor; default: null; }; translateComment: { type: StringConstructor; default: null; }; }, () => vue.VNode, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly>, { tag: string; translateN: number; translatePlural: string; translateContext: string; translateParams: Record; translateComment: string; }, {}>; /** * A directive to translate content according to the current language. * * Use this directive instead of the component if you need to translate HTML content. * It's too tricky to support HTML content within the component because we cannot get the raw HTML to use as `msgid`. * * This directive has a similar interface to the component, supporting * `translate-comment`, `translate-context`, `translate-plural`, `translate-n`. * * `

This is Sparta!

` * * If you need interpolation, you must add an expression that outputs binding value that changes with each of the * context variable: * `

I am %{ fullName } and from %{ location }

` * @deprecated */ declare function directive(language: Language): ObjectDirective; type TranslateComponent = typeof Component; type TranslateDirective = ReturnType; type Message = string | string[]; type MessageContext = { [context: string]: Message; }; type LanguageData = { [messageId: string]: Message | MessageContext; }; type Translations = { [language: string]: LanguageData; }; interface GetTextOptions { availableLanguages: { [key: string]: string; }; defaultLanguage: string; sourceCodeLanguage?: string; mutedLanguages: Array; silent: boolean; translations: Translations; setGlobalProperties: boolean; globalProperties: { language?: Array; gettext?: Array; pgettext?: Array; ngettext?: Array; npgettext?: Array; interpolate?: Array; }; provideDirective: boolean; provideComponent: boolean; } type ParameterKeys = TString extends `${infer _}%{${infer Key}}${infer Rest}` ? Key | ParameterKeys : never; type Parameters = Record, string>; type Language = UnwrapRef<{ available: GetTextOptions["availableLanguages"]; muted: GetTextOptions["mutedLanguages"]; silent: GetTextOptions["silent"]; translations: WritableComputedRef; current: string; sourceCodeLanguage?: string; $gettext: (msgid: TString, parameters?: Parameters, disableHtmlEscaping?: boolean) => string; $pgettext: (context: string, msgid: TString, parameters?: Parameters, disableHtmlEscaping?: boolean) => string; $ngettext: (msgid: TSingular, plural: TPlural, n: number, parameters?: Parameters & Parameters, disableHtmlEscaping?: boolean) => string; $npgettext: (context: string, msgid: TSingular, plural: TPlural, n: number, parameters?: Parameters & Parameters, disableHtmlEscaping?: boolean) => string; interpolate: (msgid: string, context: object, disableHtmlEscaping?: boolean) => string; install: (app: App) => void; directive: TranslateDirective; component: TranslateComponent; }>; interface GettextConfig { input: { /** only files in this directory are considered for extraction */ path: string; /** glob patterns to select files for extraction */ include: string[]; /** glob patterns to exclude files from extraction */ exclude: string[]; /** js extractor options, for custom extractor keywords */ jsExtractorOpts?: { keyword: string; options: IJsExtractorOptions; }[]; compileTemplate: boolean; }; output: { path: string; locales: string[]; potPath: string; jsonPath: string; flat: boolean; linguas: boolean; splitJson: boolean; }; } interface GettextConfigOptions { input?: Partial; output?: Partial; } declare module "@vue/runtime-core" { interface ComponentCustomProperties extends Pick { $language: Language; $gettextInterpolate: Language["interpolate"]; } interface GlobalComponents { translate: TranslateComponent; } interface GlobalDirectives { vTranslate: TranslateDirective; } } declare const useGettext: () => Language; declare function createGettext(options?: Partial): { available: { [key: string]: string; }; muted: string[]; silent: boolean; translations: Translations; current: string; sourceCodeLanguage?: string | undefined; $gettext: (msgid: TString, parameters?: Parameters | undefined, disableHtmlEscaping?: boolean | undefined) => string; $pgettext: (context: string, msgid: TString_1, parameters?: Parameters | undefined, disableHtmlEscaping?: boolean | undefined) => string; $ngettext: (msgid: TSingular, plural: TPlural, n: number, parameters?: (Parameters & Parameters) | undefined, disableHtmlEscaping?: boolean | undefined) => string; $npgettext: (context: string, msgid: TSingular_1, plural: TPlural_1, n: number, parameters?: (Parameters & Parameters) | undefined, disableHtmlEscaping?: boolean | undefined) => string; interpolate: (msgid: string, context: object, disableHtmlEscaping?: boolean | undefined) => string; install: (app: App) => void; directive: { created?: vue.DirectiveHook | undefined; beforeMount?: vue.DirectiveHook | undefined; mounted?: vue.DirectiveHook | undefined; beforeUpdate?: vue.DirectiveHook, any> | undefined; updated?: vue.DirectiveHook, any> | undefined; beforeUnmount?: vue.DirectiveHook | undefined; unmounted?: vue.DirectiveHook | undefined; getSSRProps?: ((binding: vue.DirectiveBinding, vnode: vue.VNode) => { [x: string]: unknown; } | undefined) | undefined; deep?: boolean | undefined; }; component: vue.DefineComponent<{ tag: { type: StringConstructor; default: string; }; translateN: { type: NumberConstructor; default: null; }; translatePlural: { type: StringConstructor; default: null; }; translateContext: { type: StringConstructor; default: null; }; translateParams: { type: ObjectConstructor; default: null; }; translateComment: { type: StringConstructor; default: null; }; }, () => vue.VNode, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly>, { tag: string; translateN: number; translatePlural: string; translateContext: string; translateParams: Record; translateComment: string; }, {}>; }; declare const defineGettextConfig: (config: GettextConfigOptions) => GettextConfigOptions; export { type GetTextOptions, type GettextConfig, type GettextConfigOptions, type Language, type LanguageData, type Message, type Translations, createGettext, defineGettextConfig, useGettext };