I am intermediate in Laravel. I have some published projects in Laravel for my clients.
I started a Project with Laravel with Vue using Inertia. I used a starter kit of Laravel 10 with the breeze and vue. While I am setting up my project and configuring various things, I walked through the lang
directory which I published by artisan command by Laravel 10.
I am stuck at localization. I knew how to translate and localize things with Laravel only. Here is Laravel with vue is absolutely new to me.
I researched for implementing localization but I found 3 to 4 years old resources without proper implementations and a lot of hard work even lack of some translation features of laravel.
As I stated I used the starter kit and I publish the lang directory using the artisan command. I tried to change the failed
message of the auth.php
file located in lang/en/auth.php
. I checked it by entering the wrong credential and it's appeared my updated message in error. However now I created the hi
directory for the Indian HINDI language. I copied the auth.php
and translated all three messages for this file. I changed the default locale from config/app.php
and tested again with the wrong credentials. This time it does not show my HINDI translation. It is showing the same English translation again. Even again I tried to change the translation line in English and it showed the updated line.
I inspected those file components for locating the translation source and I realize that it just showed an error message by form
. I don't know why it not picking up my translation files when I changed the default locale.
I am looking for an easier and more efficient way for localization in Laravel with Vue and Inertia.
After a lot of research, I found this package https://github.com/rmariuzzo/Laravel-JS-Localization.
Please let me know if will it do the job in an efficient way or if there is something default in Laravel with Vue and Inertia that is hidden from my eyes.
Thanks
Abhishek Kumar
Locale
. Also, this is not getting thelocale
of Laravel. When I manually change the hardcodedlocale
in theapp.blade.php
file'slang
attribute in thehtml
tag then it shows translated values. I just need a way to change thelocale
via Vue Template. – Mortgage