shaunthegeek/laravel-locale-setter
最新稳定版本:v2.0.0
Composer 安装命令:
composer require shaunthegeek/laravel-locale-setter
包简介
detect Accept-Language, setLocale for Laravel
README 文档
README
Automatically scanning the lang directory for locales, detecting the HTTP Accept-Language header, and setting the Laravel locale — all are handled seamlessly by this package.
Installation
composer require shaunthegeek/laravel-locale-setter
Add Middleware
// bootstrap/app.php
->withMiddleware(function (Middleware $middleware) {
$middleware->web(remove: [
\Illuminate\Routing\Middleware\SubstituteBindings::class,
]);
$middleware->web(append: [
ShaunTheGeek\LaravelLocaleSetter\Middleware\DetectLocale::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
]);
})
Optional
If you wish to modify the configuration, please publish it first.
php artisan vendor:publish --tag=locale-config
统计信息
- 总下载量: 48
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-05