← back

Laravel multi-language using sessions

Published Mar 12, 2024

A practical pattern for locale switching in Laravel apps using session state, middleware, and blade-friendly helpers.

Multi-language Laravel apps do not always need a full translation SaaS on day one. For many products, session-backed locale switching is enough — especially when you control both the UI strings and content negotiation.

Store the active locale in the session after a user picks a language, then apply it in middleware before the request hits controllers. Keep fallback locale explicit, and never mix Eastern and Western numerals in Arabic UI — always format numbers with Latin digits.

Pair this with route-aware language switchers so deep links preserve context when users flip between en and ar.

laraveli18nphp