spatie / laravel-medialibrary

Associate files with Eloquent models
https://spatie.be/docs/laravel-medialibrary
MIT License
5.78k stars 1.08k forks source link

Adding example to docs to pass translation keys from Vue I18n in (pro) components #3395

Closed jeffreyvanhees closed 1 year ago

jeffreyvanhees commented 1 year ago

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.

See: https://vue-i18n.intlify.dev/api/composition.html#tm-key

lang/media-library.php

<?php

return [
    'fileTypeNotAllowed' => 'Je moet een bestand van het type',
    'tooLarge' => 'Bestand te groot, maximaal',
    'tooSmall' => 'Bestand te klein, minimaal',
    'tryAgain' => 'probeer dit bestand opnieuw te uploaden',
    // ...
];
<MediaLibraryCollection
    :translations="$tm('media-library')"
/>
freekmurze commented 1 year ago

Thanks!

jeffreyvanhees commented 1 year ago

Wow that was fast @freekmurze! Thanks for accepting :)