chencongbao / multi-language
适用于laravel-admin的多语言支持扩展
This package's canonical repository appears to be gone and the package has been frozen as a result.
1.0.2
2023-03-22 02:13 UTC
Requires
- php: >=7.0.0
- encore/laravel-admin: ~1.6
Requires (Dev)
- phpunit/phpunit: ~6.0
This package is not auto-updated.
Last update: 2024-04-03 07:39:03 UTC
README
Install
composer require chencongbao/multi-language
Config
First, add extension config
In config/admin.php
'extensions' => [
'multi-language' => [
'enable' => true,
// the key should be same as var locale in config/app.php
// the value is used to show
'languages' => [
'en' => 'English',
'zh-CN' => '简体中文',
],
// default locale
'default' => 'zh-CN',
// if or not show multi-language login page, optional, default is true
'show-login-page' => true,
// if or not show multi-language navbar, optional, default is true
'show-navbar' => true,
// the cookie name for the multi-language var, optional, default is 'locale'
'cookie-name' => 'locale'
],
],
Then, add except route to auth
In config/admin.php
, add locale
to auth.excepts
'auth' => [
...
// The URIs that should be excluded from authorization.
'excepts' => [
'auth/login',
'auth/logout',
// add this line !
'locale',
],
],
In App\Http\Middleware\EncryptCookies
,add locale
to except
protected $except = [
'locale'
];
ScreenShots