Building a bilingual Laravel site without a localisation package
- Text
- Mihai Solomon
- Date
- Read
- 1 min
Most tutorials reach for a localisation package on day one. For a two-language site, I found that the package added more concepts than it removed.
The pieces#
- One config file listing the supported locales
- A helper that builds every route name with its locale prefix
- A middleware that sets the app locale from the matched route
- A polymorphic slugs table, unique per locale, with old slugs kept and redirected
What it bought me#
No magic, no duplicate route names, and SEO tags generated from the same source of truth as the URLs.
- Text
- Mihai Solomon
- Date
- Read
- 1 min