Skip to content

Commit

Permalink
Adding example to pass translation keys from Vue I18n in components (#…
Browse files Browse the repository at this point in the history
…3395)

The package vue-i18n (https://vue-i18n.intlify.dev/) offers a $tm-function to pass all keys at once as an array from a translation file. Maybe it's good to adapt this in the documentation.

https://vue-i18n.intlify.dev/api/composition.html#tm-key
jeffreyvanhees authored Sep 27, 2023

Verified

This commit was signed with the committer’s verified signature.
chuckha Chuck Ha
1 parent 455cd0e commit e5251db
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -687,6 +687,14 @@ window.mediaLibraryTranslations = {
};
```

If you use the [vue-i18n](https://vue-i18n.intlify.dev/) package from intlify, you can also pass the keys from a translation file like `lang/media-library.php` by using the [`$tm`-function](https://vue-i18n.intlify.dev/api/composition.html#tm-key).

```js
<MediaLibraryCollection
:translations="$tm('media-library')"
/>
```

## Props

These props are available on both the `attachment` and the `collection` component.

0 comments on commit e5251db

Please sign in to comment.