Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Multilingual Routes

Laravel Multilingual Routes Laravel Package

chinleung/laravel-multilingual-routes

Register multilingual Laravel routes with a single multilingual() call. It maps paths and route names per configured locale, can detect the request locale via middleware, and supports Laravel 9 through 13 depending on package version. Ideal for localized URLs without duplicating route definitions.

View on GitHub
Deep Wiki
Context7

A package to register multilingual routes.

Frequently asked questions about Laravel Multilingual Routes
How do I install chinleung/laravel-multilingual-routes?
Install the package with Composer using composer require chinleung/laravel-multilingual-routes. Then add the DetectRequestLocale middleware to the start of your web middleware group in bootstrap/app.php. If you need to customize locale behavior, publish the config file with the vendor:publish command and the config tag.
Which Laravel versions does laravel-multilingual-routes support?
The package supports Laravel 9 through 13 using version-specific branches. Use v3 for Laravel 9.x, v4 for Laravel 10.x and 11.x, v5 for Laravel 12.x, and v6 for Laravel 13.x. This branching helps reduce upgrade risk when moving between Laravel versions.
How does Route::multilingual() work compared with defining routes per locale?
Route::multilingual() registers the route for each configured locale and applies the appropriate locale prefix automatically. You can use one route name such as home instead of manually defining names like en.home and fr.home. This keeps route references in Blade templates, controllers, and redirects consistent.
How do I configure supported locales for multilingual routes?
You can set the app.locales configuration value or use the configuration from chinleung/laravel-locales. By default, the package uses only en and does not prefix the default locale. Publish the package config if you want to change default locale prefixing or other behavior.
Where should I place the DetectRequestLocale middleware?
DetectRequestLocale must be the first middleware in Laravel's web middleware group. In modern Laravel skeletons, add it in bootstrap/app.php using the web prepend option. Placing it first helps locale detection happen before authentication, CORS, or other middleware that may depend on the current locale.
How do I translate route URIs per locale?
The package uses resources/lang/{locale}/routes.php files for URI translations, so each locale can have a different path such as test in English and teste in French. Keep dynamic route parameters like {id} explicitly defined in those translations to avoid mismatched URLs or 404s. For large applications, plan to maintain these files as routes change.
Does laravel-multilingual-routes support resource routes?
Yes, the package extends Laravel's resource routing with multilingualResource() to generate locale-aware CRUD routes. It also supports chainable methods such as only(), except(), and names() to mirror Laravel's native route API. This reduces boilerplate when you need multilingual resource URLs.
How do I redirect non-prefixed URLs to locale-prefixed URLs?
Version 6.0.1 adds an opt-in redirect option for non-prefixed routes, so a URL like /test can redirect to its locale-prefixed equivalent such as /en/test. You must enable and tune it deliberately, including settings for status code, default locale, and exclusions. You can also publish the config to prefix the default locale instead of relying on redirects.
Does route caching work with multilingual routes?
Multilingual routes are registered through Laravel's normal routing system, so route caching can work, but you should validate it in your deployment process. Rebuild the route cache after configuration or locale changes, and test locale-prefixed URLs after running php artisan route:cache. If you use dynamic translated URIs, confirm that all locale variants are registered before caching.
What are the limitations or alternatives to laravel-multilingual-routes?
The package is tightly coupled to Laravel and requires ongoing maintenance of per-locale routes.php translation files. Its non-prefixed redirect behavior is opt-in, and default locale handling needs deliberate configuration to avoid ambiguous URLs. Alternatives include mcamara/laravel-localization or manually grouping routes with locale prefixes if you need different fallback or integration behavior.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console