alessandrobelli/lingua
Lingua is a Laravel package that simplifies multilingual support and localization. It helps organize language files, manage translations, and streamline workflows so your application can serve users in multiple languages with less setup and cleaner configuration.
Accept-Language negotiation, session persistence of a chosen locale, fallback resolution, and Blade/helper access to the active locale. The reference implementation in the docs is roughly ten lines of middleware plus a POST /locale/{locale} route. That is a decision input in itself: the buy option here saves a day, not a sprint.lang/it/*.php files, translate model attributes, or provide an editing UI. Framing localization this way forces the correct budget conversation: the code is cheap, the content and translation operations are the real cost and the real roadmap item.users table and re-applied at login), and per-request locale override. These are small, well-bounded features that can be scheduled and shipped independently of any content translation work.composer require.^0.3 and treating the package as a starting point you own rather than a maintained dependency.StartSession, one source of truth for locale, alias mapping for region variants like it-CH → it, Vary: Accept-Language, cache keys including locale, explicit locale on queued jobs and mailables, locale reset in tests — are worth copying into a homegrown implementation regardless of the vendor decision.lang files are sufficient and this adds a dependency for no gain.pricing.title.To executives: This is a small Laravel package for language detection and switching — it recognizes a visitor's preferred language, remembers their choice, and falls back to a default. It does not translate anything; it routes people to the right existing translation. The honest assessment is that the capability is modest, comparable to a couple of days of our own work, and this particular package is a single-maintainer project with no release since 2022. My recommendation is not to take a dependency on it: we can implement the same behavior in-house in a short, well-understood effort, keep full ownership, and avoid an unsupported component in a customer-facing path. Use the package's documentation as our design checklist — middleware ordering, caching, and SEO handling are where these implementations actually break.
To engineering: Lingua covers locale negotiation and switching only — config-driven locale list, Accept-Language detection, session persistence, fallback, Blade/helper access. It does not touch model-attribute translation, translation files, or any editing surface. Given 0.3.1 with no stated changes, two stars, and no commits since October 2022, the recommendation is to treat it as a reference implementation rather than a dependency. If we build it ourselves, the acceptance criteria are: middleware registered on the web group after StartSession and before anything renders translated content; an explicit and documented negotiation order (user choice → session → header → fallback); region-variant alias mapping in exactly one place; locale-aware cache keys and a Vary: Accept-Language header on cacheable responses; explicit locale set on queued jobs and mailables; and a test suite that asserts negotiation, asserts persistence, and resets locale in tearDown(). If we do pilot the package instead, keep it behind a thin middleware/controller wrapper, pin ^0.3, and timebox the spike against our real routes so a swap is a one-file change.
Recommendation: Do not adopt. Build the negotiation layer in-house (~1–2 days) using Lingua's documented patterns as the specification, and reserve a formal adopt/replace review only if a maintained package with an active issue queue emerges that matches our requirements.
How can I help you explore Laravel packages today?