I'm currently working on application's translation with Laravel Localization (laravel 5.6).
I succeed my text translation on blade templates but I have some view using vuejs.
Into them I can't use directly laravel localization.
I understand that I have to send my translations files (which are in PHP) into the vue in JS.
I found some packages like :
https://github.com/rmariuzzo/Laravel-JS-Localization ; but it doesn't support laravel 5.6 (damned)...
https://github.com/martinlindhe/laravel-vue-i18n-generator ; Laravel 5 package is no longer maintain...
This application use Laravel 5.6 and vue 2.
I can't completely reorganize or upgrade Laravel or vue version.
After many research I'm still not able to do it...
Do you know how can I made translation into my vue component?
Thanks a a lot!
Related
I am building a project using Laravel + Vue, I used Vuei18n to localization in vue ,and laravel-translatable was used in Laravel ,but laravel-translatable does not work in a components, it shows all translations of the data, for example:
{en: "Hello" , ar:"مرحبا"}
on laravel I was using Middleware and Prefix to display the text depending on the language, but with vue + laravel this feature does not work.
is there any suggestion or solutions?
When working with Laravel, it seems I can use Vue inside the Laravel Blade but I can also use Laravel project only as an API while using another project (Vue in this case) as a front-end connecting to the API?
Which approach is better and has its advantages/disadvantages?
I'm building a multi language website using Laravel and VueJS. I've build many vue components and laravel blade files in same html structure and those are different languages. I suppose to make different route file to each language.
But my problem is I cannot switch between different language. Please let me know how to do that?
If you're using blade and Vue as a library you can use https://github.com/mcamara/laravel-localization
If you're using Vue as SPA you can use https://github.com/kazupon/vue-i18n
I have built my static design using vue.js. Now, I need to integrate it within Laravel.
Once I do integrate Laravel with Vue then Laravel is not getting the Design files path. I mean the various Style and JS files.
FYI, I build the Vue in static design and it was working fine before integration with Laravel. But, while integrating with Laravel I am no longer using the build or build.js file. Instead of this, I am building using Laravel ways.
The main issue is the design is broken and the route is not working.
how to combine Laravel and React? I mean, Laravel uses blade for its view, how to change it to React instead of blade ? There have been so many Laravel and Angular tutorial, but I can't find any for React and Laravel?
Any references of Laravel and ReactJS tutorial ?
If you are using Laravel to build a REST web service (API), then you might not need Blade. You just return JSON data. Your React App can then make calls to the Laravel API for data and process it right in the browser. You don't need Blade for this.
You would use Laravel to provide the base view (index.blade.php) which would include the React JS app, but then after that all the views and routing would be handled by React.
Here's a link to get you started.
https://medium.com/#rajikaimal/laravel-loves-reactjs-8c02f8b9d1d5
I have created laravel reactjs starter project .. refer the github project below.
I am not using the mix api of laravel since I want reactjs app to be portable to any other server or standalone app
refer the link below
https://medium.com/#padmanabhavn/bringing-laravel-and-reactjs-together-8c970cb0f65d
This question seems old but I will still share my experience for others.
This tutorial and project sample may be found useful.
https://blog.pusher.com/react-laravel-application/
https://github.com/maarcz/taskman
As well as that, the solution below has worked for me in webpack.mix.js without using app.js to be mixed up with other requirements (laravel 8):
mix.js('resources/assets/js/react', 'public/js/reactJs').react()
in blade:
<script src="{{ asset('js/reactJs/react.js') }}"></script>