Black Friday: the Laravel testing course is $149 instead of $249, through Dec 7. See the course →
logo

A simple approach to localization using middleware

Only one file

Joel Clermont
Joel Clermont
2025-09-05

From our daily Laravel tips email. Get the next one in your inbox.

Laravel gives us all the tools we need to localize our application. We can show translated strings and properly format dates, numbers, and currencies.

But one thing Laravel doesn't specify for us is how to determine which language to use.

In today's video, I'll show a simple middleware-based approach we have used successfully in our projects. It will give you a starting point to think about language selection in your app.

Watch Now (5 min)

And after watching, don't forget to subscribe to our YouTube channel, so you don't miss future videos.

Here to help,

Joel

P.S. Even in this simple middleware example, we don't forget validation. We truly believe validation is an extremely important part of any Laravel app.

Want a tip like this in your inbox every weekday?

Each one takes less than 2 minutes to read. Join 4,000+ Laravel developers who already get them.

email
No spam. Only real-world advice.
Toss a coin in the jar if you found this helpful.