Laravel (Blade) @lang in Vue components

Asked

Viewed 85 times

1

Recently I started using Vuejs with Laravel and one of the first problems I faced was how to use the translations of Laravel (from the folder resource/lang ) in the Vue Components because in Blade it is simply to use @lang, or @Choice for example.

And as my first solution I passed the translations as variables through the Blade to the component, but what happens is that inside another component I call another component and I didn’t want to keep passing the translations through variables because I polluted a lot.

And I was thinking of using Vueresource in the components to send a request for the API and the API to return an entire array with the translations I need.

My question is: is this feasible to do? And if not, what should I do.

  • Take a look at this repository (https://github.com/jcc/blog), here’s an example of multi lang with Vue and Laravel.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.