Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

srikanthgopi's avatar

Laravel vue translations

I'm using this template for laravel api and vuejs frontend

https://github.com/cretueusebiu/laravel-vue-spa

This template uses "vue-i18n": "^7.6.0", and works fine to pull up translations from json file. These are for the static text on the website.

I want to add translations for my eloquent models too along with this "vue-i18n": "^7.6.0", translations. I have created

Articles table id author_id created_at updated_at

Article_translations table id article_id locale_code title description

As you can see the template already has a language switcher in navigation. The static text changes when i choose a different language. I want to display the article according to the language choose by the switcher. How to make this sync.

0 likes
1 reply
bobbybouwmann's avatar
Level 88

I think you need to do handle this in your api part. So for example when you fetch an article you also need to send which locale the API should return. I bet you can simply ask your vue instance what the current locale is and send that in every api request to the server.

This was you have to do some kind of refresh of all the data in your view because the data might have changed for other languages

Please or to participate in this conversation.