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

mesqueeb's avatar

Laravel standard Authentication in different languages

Dear Community,

I created the Laravel Authentication through php artisan, now I want to add the Japanese language to the login pages and a new route for /ja/login.

I created a Japanese homepage in my viewController like so:

public function indexJA()
{
    \App::setLocale('ja');
    return view('layouts.welcome');
}

And then I made a folder 'ja' in recources/views/lang with strings for the Japanese text.

But I'm not sure how to create the Japanese page for all routes/controllers for the Authentication, as Laravel whipped these up for me...

Any ideas?

0 likes
3 replies
juandmegon's avatar

Maybe is a better idea to establish the language globally using a middleware. In that way, you will be able to show the entire site on Japanese and not only the authentication stuff. You maybe want to change the language based on a user preference or based on any URL segment or even in a session value (it is up on you)

mesqueeb's avatar

That's a great idea! Will my site still be cashed in all languages by Google when using middleware?

Also, do you have any example? (or a guide?) I haven't used middleware before.

christianTorino's avatar

Hello @mesqueeb, You can use 2 packages that personally i loved for localized project.

The first is https://github.com/mcamara/laravel-localization . It handles for you all the localization staff and in an more advanced configuration you can choose to use localized url or not. The translation can be applied by user choose or detecting the browser language.

The second is https://github.com/barryvdh/laravel-translation-manager. It gives you the possibility to handle to languge files all togethers, thorugh a simple ui.

Give them a look.

Bye

Please or to participate in this conversation.