Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: intlify/vue-i18n-extensions
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.1.0
Choose a base ref
...
head repository: intlify/vue-i18n-extensions
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v6.1.1
Choose a head ref
  • 3 commits
  • 5 files changed
  • 2 contributors

Commits on Jun 12, 2024

  1. chore: generate changelog

    kazupon authored and github-actions[bot] committed Jun 12, 2024
    Copy the full SHA
    9065c5e View commit details

Commits on Jun 13, 2024

  1. fix: export TranslationSignatureResolver type (#228)

    kazupon authored Jun 13, 2024
    Copy the full SHA
    11da741 View commit details
  2. release: v6.1.1

    kazupon committed Jun 13, 2024
    Copy the full SHA
    ab441e0 View commit details
Showing with 64 additions and 3 deletions.
  1. +11 −0 CHANGELOG.md
  2. +49 −1 docs/@intlify/vue-i18n-extensions-api.md
  3. +1 −1 package.json
  4. +1 −1 src/index.ts
  5. +2 −0 src/transform.ts
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# v6.1.0 (2024-06-12T04:38:08Z)

This changelog is generated by [GitHub Releases](https://github.com/intlify/vue-i18n-extensions/releases/tag/v6.1.0)

###    🚀 Features

- Translation signature resolver &nbsp;-&nbsp; by @kazupon in https://github.com/intlify/vue-i18n-extensions/issues/226 [<samp>(ae54f)</samp>](https://github.com/intlify/vue-i18n-extensions/commit/ae54fb3)

##### &nbsp;&nbsp;&nbsp;&nbsp;[View changes on GitHub](https://github.com/intlify/vue-i18n-extensions/compare/v6.0.6...v6.1.0)


# v6.0.6 (2024-06-11T08:04:09Z)

This changelog is generated by [GitHub Releases](https://github.com/intlify/vue-i18n-extensions/releases/tag/v6.0.6)
50 changes: 49 additions & 1 deletion docs/@intlify/vue-i18n-extensions-api.md
Original file line number Diff line number Diff line change
@@ -6,6 +6,8 @@
- [transformVTDirective](#transformvtdirective)
- [Interface](#interface)
- [TransformVTDirectiveOptions](#transformvtdirectiveoptions)
- [TypeAlias](#typealias)
- [TranslationSignatureResolver](#translationsignatureresolver)

## Function

@@ -127,7 +129,7 @@ Translation function signatures

**Signature:**
```typescript
translationSignatures?: string | string[];
translationSignatures?: string | TranslationSignatureResolver | string[] | TranslationSignatureResolver[] | (string | TranslationSignatureResolver)[];
```

#### Remarks
@@ -136,3 +138,49 @@ You can specify the signature of the translation function attached to the bindin



## TypeAlias

### TranslationSignatureResolver

Translation signature resolver

**Signature:**
```typescript
type TranslationSignatureResolver = (context: TransformContext) => string;
```

#### Remarks

This resolver is used at ['translationSignatures' option](#transformvtdirectiveoptions)

###1 Examples


```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 }
})
```



2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@intlify/vue-i18n-extensions",
"description": "vue-i18n extensions",
"version": "6.1.0",
"version": "6.1.1",
"author": {
"name": "kazuya kawaguchi",
"email": "kawakazu80@gmail.com"
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { transformVTDirective } from './transform'
export type { TransformVTDirectiveOptions } from './transform'
export type { TransformVTDirectiveOptions, TranslationSignatureResolver } from './transform'
2 changes: 2 additions & 0 deletions src/transform.ts
Original file line number Diff line number Diff line change
@@ -56,6 +56,8 @@ type VTDirectiveValue = {
* @remarks
* This resolver is used at {@link TransformVTDirectiveOptions | 'translationSignatures' option}
*
* @public
*
* @example
* ```js
* import { compile } from '@vue/compiler-dom'