雪软 / multi-language
适用于laravel-admin的多语言支持扩展
0.01
2023-12-28 22:23 UTC
Requires
- php: >=7.0.0
- snowsoft/laravel-admin: *
Requires (Dev)
- phpunit/phpunit: ~6.0
This package is auto-updated.
Last update: 2024-09-29 00:01:15 UTC
README
安装
composer require snowsoft/multi-language
配置
首先,添加扩展配置
在 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'
],
],
然后,将路由排除在认证之外
在 config/admin.php
中,将 locale
添加到 auth.excepts
'auth' => [
...
// The URIs that should be excluded from authorization.
'excepts' => [
'auth/login',
'auth/logout',
// add this line !
'locale',
],
],