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
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
  • Loading branch information
jeffreyvanhees authored Sep 27, 2023
1 parent 455cd0e commit 7f93426
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7f93426

Please sign in to comment.