@intlify/vue-i18n-extensions
Advanced tools
Comparing version 6.0.6 to 6.1.0
@@ -1,5 +0,39 @@ | ||
import { DirectiveTransform } from '@vue/compiler-dom'; | ||
import { DirectiveTransform, TransformContext } from '@vue/compiler-dom'; | ||
import { I18n, I18nMode } from 'vue-i18n'; | ||
/** | ||
* Translation signature resolver | ||
* | ||
* @remarks | ||
* This resolver is used at {@link TransformVTDirectiveOptions | 'translationSignatures' option} | ||
* | ||
* @example | ||
* ```js | ||
* import { compile } from '@vue/compiler-dom' | ||
* import { transformVTDirective } from '@intlify/vue-i18n-extensions' | ||
* | ||
* // the below is just an example, you can use your own signature resolver | ||
* const signatureMap = new Map() | ||
* | ||
* const transformVT = transformVTDirective({ | ||
* translationSignatures: (context) => { | ||
* const { prefixIdentifiers, bindingMetadata, inline, filename } = context | ||
* let signature = '' | ||
* | ||
* // something logic to resolve signature like using `signatureMap` | ||
* // signature = signatureMap.get(filename) | ||
* // ... | ||
* | ||
* return signature | ||
* } | ||
* }) | ||
* | ||
* const { code } = compile(`<p v-t="'hello'"></p>`, { | ||
* // ... | ||
* directiveTransforms: { t: transformVT } | ||
* }) | ||
* ``` | ||
*/ | ||
type TranslationSignatureResolver = (context: TransformContext) => string; | ||
/** | ||
* Transform options for `v-t` custom directive | ||
@@ -40,3 +74,3 @@ * | ||
*/ | ||
translationSignatures?: string | string[]; | ||
translationSignatures?: string | TranslationSignatureResolver | string[] | TranslationSignatureResolver[] | (string | TranslationSignatureResolver)[]; | ||
} | ||
@@ -43,0 +77,0 @@ /** |
{ | ||
"name": "@intlify/vue-i18n-extensions", | ||
"description": "vue-i18n extensions", | ||
"version": "6.0.6", | ||
"version": "6.1.0", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "kazuya kawaguchi", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
58580
1062