Skip to content

Comparison & Background

When to use this package

Use it for:

  • automatic locale detection (browser, session, cookie, custom)
  • automatic redirects to localized routes
  • hidden default locale in URLs (/about instead of /en/about)
  • fully translatable routes (/en/humans vs /de/menschen)

You don't need it if you're fine with example.com/de/blog / example.com/en/blog only and don't need detection or unprefixed defaults.

Comparison to other packages

mcamara/laravel-localization

The original package this one succeeds. Still maintained by @jordyvanderhaegen for Laravel/PHP compatibility, security, and small bug fixes. Long legacy codebase whose original architecture comes with limitations that motivated this rewrite - see Why migrate.

codezero-be/laravel-localized-routes (deprecated)

Route-per-locale (Nx routes per definition). No longer maintained, but its design ideas influenced this one - here only two routes per definition.

spatie/laravel-translatable

Translates Eloquent model fields, not routes. Works alongside this package for translatable slugs.

Background

I (Adam Nielsen) was a collaborator on the original mcamara/laravel-localization. Since @mcamara has moved on from Laravel, @jordyvanderhaegen continues to maintain it for compatibility and small fixes. This rewrite addresses long-standing limitations that follow from the original's runtime route generation.

The original generated dynamic routes (cache + compatibility issues). laravel-localized-routes solved this with static per-locale routes (Nx per definition). This package takes the middle path: each route registered twice (one with {locale}, one without).

Credits

Since @codezero-be is no longer with us, I want to acknowledge his great work and influence on this package. Many of his ideas live on here, and I hope this helps to keep his contributions useful to the Laravel community for years to come.

Released under the MIT License.