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

msplash9's avatar

Laravel and Vuejs - how do I handle language translations ?

Can any one suggest me the best way to handle language translations from laravel to vue ?

Thanks

0 likes
6 replies
davorminchorov's avatar

Language translation? Passing data from the server to the client?

msplash9's avatar

@Ruffles Sorry I did not make it clear

Yes language translations . I would prefer to use laravel localisation method , if there is any proper way . But if its not a good method I would go with vue i18n plugins

zachleigh's avatar

I think it depends largely on what you want to do with the translations. If you want them to be interactive client side, then youre probably going to have to send data to the server and fetch the translations. If the client side translations are static, you can just send them in your components. I usually bundle all my translations up and send them in a json array in my components.

1 like
srikanthgopi's avatar

@zachleigh I'm currently using static translations via lang folder/json file.

However, i would also like to add translations to eloquent models For example

Article (id, category_id, created_at, updated_at) Article_translations(id, article_id, locale_code, content)

I want this to work along with the main translations that i have created with vue i18n so that when i select ES the spanish article is produced on the component. I use {{ $t('name" }} to fetch translations. How to fetch translations from db and get it synced with language picker

Please or to participate in this conversation.