vue3-gettext
Advanced tools
Comparing version 2.0.0-alpha.1 to 2.0.0-alpha.2
import * as vue from 'vue'; | ||
import { UnwrapRef, WritableComputedRef, App, Directive } from 'vue'; | ||
import { ObjectDirective, UnwrapRef, WritableComputedRef, App } from 'vue'; | ||
@@ -57,3 +57,21 @@ /** | ||
declare type ComponentType = typeof Component; | ||
/** | ||
* 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 <translate> component, supporting | ||
* `translate-comment`, `translate-context`, `translate-plural`, `translate-n`. | ||
* | ||
* `<p v-translate translate-comment='Good stuff'>This is <strong class='txt-primary'>Sparta</strong>!</p>` | ||
* | ||
* If you need interpolation, you must add an expression that outputs binding value that changes with each of the | ||
* context variable: | ||
* `<p v-translate="fullName + location">I am %{ fullName } and from %{ location }</p>` | ||
*/ | ||
declare function directive(language: Language): ObjectDirective<HTMLElement, any>; | ||
declare type TranslateComponent = typeof Component; | ||
declare type TranslateDirective = ReturnType<typeof directive>; | ||
declare type Message = string | string[]; | ||
@@ -93,4 +111,4 @@ declare type MessageContext = { | ||
install: (app: App) => void; | ||
directive: Directive; | ||
component: ComponentType; | ||
directive: TranslateDirective; | ||
component: TranslateComponent; | ||
}>; | ||
@@ -119,2 +137,13 @@ interface GettextConfig { | ||
} | ||
declare module "@vue/runtime-core" { | ||
interface ComponentCustomProperties extends Pick<Language, "$gettext" | "$pgettext" | "$ngettext" | "$npgettext"> { | ||
$gettextInterpolate: Language["interpolate"]; | ||
} | ||
interface GlobalComponents { | ||
translate: TranslateComponent; | ||
} | ||
interface GlobalDirectives { | ||
vTranslate: TranslateDirective; | ||
} | ||
} | ||
@@ -143,14 +172,14 @@ declare const useGettext: () => Language; | ||
install: (app: App<any>) => void; | ||
directive: vue.FunctionDirective<any, any> | { | ||
created?: vue.DirectiveHook<any, null, any> | undefined; | ||
beforeMount?: vue.DirectiveHook<any, null, any> | undefined; | ||
mounted?: vue.DirectiveHook<any, null, any> | undefined; | ||
beforeUpdate?: vue.DirectiveHook<any, vue.VNode<any, any, { | ||
directive: { | ||
created?: vue.DirectiveHook<HTMLElement, null, any> | undefined; | ||
beforeMount?: vue.DirectiveHook<HTMLElement, null, any> | undefined; | ||
mounted?: vue.DirectiveHook<HTMLElement, null, any> | undefined; | ||
beforeUpdate?: vue.DirectiveHook<HTMLElement, vue.VNode<any, HTMLElement, { | ||
[key: string]: any; | ||
}>, any> | undefined; | ||
updated?: vue.DirectiveHook<any, vue.VNode<any, any, { | ||
updated?: vue.DirectiveHook<HTMLElement, vue.VNode<any, HTMLElement, { | ||
[key: string]: any; | ||
}>, any> | undefined; | ||
beforeUnmount?: vue.DirectiveHook<any, null, any> | undefined; | ||
unmounted?: vue.DirectiveHook<any, null, any> | undefined; | ||
beforeUnmount?: vue.DirectiveHook<HTMLElement, null, any> | undefined; | ||
unmounted?: vue.DirectiveHook<HTMLElement, null, any> | undefined; | ||
getSSRProps?: ((binding: vue.DirectiveBinding<any>, vnode: vue.VNode<vue.RendererNode, vue.RendererElement, { | ||
@@ -157,0 +186,0 @@ [key: string]: any; |
{ | ||
"name": "vue3-gettext", | ||
"version": "2.0.0-alpha.1", | ||
"version": "2.0.0-alpha.2", | ||
"description": "Translate your Vue.js 3 applications with gettext", | ||
@@ -5,0 +5,0 @@ "author": "Leo Zurbriggen", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
88544
1914