route:cache compatible
Two static routes per definition (with and without a locale prefix) - no dynamic registration, full Laravel ecosystem compatibility.
Detect a visitor's language, redirect to the matching locale, and let `route('about')` always pick the right URL - fully `route:cache` compatible.
Route::localize(function () {
Route::get('/about', AboutController::class)->name('about');
});Produces:
/about - default locale (e.g. English), prefix hidden/de/about - German/fr/about - French (and so on for every configured locale)In your code, keep using route('about') - the package picks the right variant based on the current locale.
mcamara/laravel-localization This package is the official successor to mcamara/laravel-localization, rebuilt on static routes so that php artisan route:cache works out of the box and translated routes resolve through Laravel's own URL generator - no URI parsing required.
Migrating from the original? See the step-by-step migration guide.