Skip to content

v1.1.0

Choose a tag to compare

@niels-numbers niels-numbers released this 04 May 08:16
· 40 commits to main since this release

[1.1.0] - 2026-05-04

Added

  • Localizer::setActiveDefaultLocale(?string) and Localizer::defaultLocale(): per-request runtime override for the package's default locale (the one whose URLs are unprefixed when hide_default_locale is on). Mirrors the setActiveLocales() pattern - request-scoped property on the Localizer singleton, defaulting to config('app.fallback_locale'). Lets multi-tenant apps swap the default locale per request without mutating Laravel's translation fallback or leaking state across Octane workers.
  • NielsNumbers\LaravelLocalizer\Routing\LocalizerZiggyV2: package-shipped Ziggy adapter for tighten/ziggy v2+. Bind \Tighten\Ziggy\Ziggy::class to it in AppServiceProvider::register() to make route('about') locale-aware in JS.
  • NielsNumbers\LaravelLocalizer\Routing\LocalizerZiggyV1 + LocalizerBladeRouteGeneratorV1: same for tightenco/ziggy v1, which instantiates Ziggy directly inside its BladeRouteGenerator and bypasses the container - so the generator itself has to be rebound.
  • NielsNumbers\LaravelLocalizer\Routing\Concerns\RewritesRoutesForLocale: shared trait holding the locale-aware route-manifest rewrite logic used by both Ziggy adapters.
  • Composer suggest entries for tighten/ziggy and tightenco/ziggy pointing at the matching adapter.

Changed

  • UrlGenerator, RedirectLocale, SetLocale and CurrentRouteLocalizer now read the default locale through Localizer::defaultLocale() instead of config('app.fallback_locale') directly. No behaviour change for non-tenant apps; tenant apps using setActiveDefaultLocale() see the override applied to URL generation, redirects, and the SetLocale fallback. TranslateMacro still reads Config directly because the without_locale.* variant is baked at boot.
  • README: TOC restructured into six grouped sections (Getting Started, Defining Routes, Rendering URLs, Runtime Behavior, Advanced, About) with indented sub-bullets.

Docs

  • New docs/multitenancy.md: full multitenancy guide, including the new setActiveDefaultLocale() flow and the Route::translate() boot-vs-middleware caveat. Replaces the in-README section.
  • New docs/caveats-and-recipes.md: edge cases (route name collisions, controller arguments, middleware order, route model binding with translated slugs) extracted from the README.
  • docs/javascript-route-helpers.md: rewritten around the shipped adapters - users now only add a one-line container bind in AppServiceProvider instead of copying the adapter into app/Routing/.
  • docs/language-switcher.md: cleanup - dropped the misleading "Inertia bridge" wording and the experimental SPA switcher info box. The inertia-spa-language-switch.md page is no longer linked from the sidebar.
  • docs/jobs-mailables-notifications.md: removed internal-Laravel withLocale() mechanics and framework PR/issue links from the Mailables and Notifications sections; both are described as "automatic" since users only see the ->locale() / HasLocalePreference API.
  • docs/caveats-and-recipes.md: clarified that SetLocale only overwrites app.locale inside Route::localize() / Route::translate(). For plain unlocalized routes, console commands, and jobs, the initial config/app.php value stays in effect.
  • docs/comparison.md: trimmed the mcamara/laravel-localization section to "long legacy with architectural limitations" and a link to the migration guide's "Why migrate" section, removing the duplicated bullet list.
  • docs/migrating-from-laravel-localization.md: rewrote the "Why migrate" section. Verbose paragraphs and the deep-dive into getRouteNameFromAPath / parse_url internals are gone, replaced by punch-line bullets. New bullets for Multi-tenant ready (setActiveLocales() / setActiveDefaultLocale()) and Modular architecture friendly (per-module Route::localize() vs the original's per-module LaravelLocalization::setLocale() side effect that re-ran on every module's route group).