codezero-be / laravel-localized-routes

⭐️ A convenient way to set up and use localized routes in a Laravel app.
MIT License
504 stars 46 forks source link

Custom prefixes #70

Closed tanerkay closed 1 year ago

tanerkay commented 1 year ago

Adds backwards compatible support for custom prefixes. This aims to cover one part of #20.

I've used the term "custom prefixes" instead of "slugs" as the latter is used elsewhere in the codebase to reference parts of the path that get localized.

The approach is to preserve the route name prefix as the application locale, and to modify the URL generators to use a custom prefix, if provided.

If custom prefixes are not set, or there is not a custom prefix for any specific locale, the locale string itself is used.

ivanvermeyen commented 1 year ago

Looks great! Thanks!