Laravel Localizer
niels-numbers/laravel-localizerПакет автоматично визначає найбільш підходящу мову користувача та перенаправляє його на локалізований URL відповідно до його переваг.
README
Laravel Localizer
Successor to
mcamara/laravel-localization. Static routes,route:cacheready.
Locale-aware routing for Laravel: auto-detect, auto-redirect, and resolve route() per language.
Documentation: localizer.adam-nielsen.de
Example
Route::localize(function () {
Route::get('/about', AboutController::class)->name('about');
});
Produces:
/about- this endpoint carries the package's core magic: auto-detection, redirect, or default locale (see below)/de/about,/fr/about, ... for every other configured locale
Every route is registered twice as a static route:
GET|HEAD about ............... without_locale.about › AboutController
GET|HEAD {locale}/about .......... with_locale.about › AboutController
In your application code, keep using route('about'); the package
picks the right variant based on the current locale.
How /about resolves at request time:
- First visit: the package reads the
Accept-Languageheader (or your own detector chain) and redirects to the matching localized URL. - Subsequent visits: an explicit URL prefix always wins.
Without a URL signal, the locale is taken from the session and
cookie. The user is redirected to the prefixed variant unless
their locale matches the default and
hide_default_localeis on - in which case they are redirected or stay on/about. - Fallback: when no signal matches, the configured default locale is used.
Note: a switcher link to plain
/aboutcarries no locale signal -RedirectLocalewould send the user back to their session locale instead of switching. See Language Switcher for more.
Install
composer require niels-numbers/laravel-localizer
Setup guide · Migrating from mcamara/laravel-localization?
License & credits
MIT licensed. Created by Adam Nielsen, building on prior work by
@mcamara (original
laravel-localization),
@codezero-be (deprecated
laravel-localized-routes, whose static-route ideas inspired this
rewrite) and
@jordyvanderhaegen (current
maintainer of the original, whose
issue #921
motivated this package).
Схожі пакети
Lang
laravel-lang/langСписок 126 мов для Laravel Framework, Laravel Jetstream, Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova, Laravel Spark та Laravel UI.
Laravel Localization
mcamara/laravel-localizationПростий інструмент для локалізації Laravel-додатків, що полегшує управління мовними версіями та перекладами.
Laravel Translatable
spatie/laravel-translatableТрейт для збереження перекладів у моделях Eloquent.
Laravel Translatable
astrotomic/laravel-translatableПакет для роботи з багатомовними моделями в Laravel, що дозволяє легко керувати перекладами даних на різні мови.
Laravel Translation Loader
spatie/laravel-translation-loaderПакет дозволяє зберігати мовні рядки в базі даних, YAML або інших джерелах замість традиційних файлів локалізації.
Інформація
- Версія
- v1.4.0
- Laravel
- 13
- Зірки
- 18
- Завантажень
- 3.2k
- Реліз
- 5 червня 2026
- Категорія
- Багатомовність