laravel框架安裝多國語言包
阿新 • • 發佈:2019-01-29
laravel的一些提示資訊都是預設英文,想更改為中文需要下載語言包,執行以下命令
composer require caouecs/laravel-lang:~3.0
執行完後將vendor中的caouecs中的src中的zh-CN資料夾放到views的lang資料夾中
然後還要更改配置項,將config裡面的app.php裡的locale改為zh-CN
'locale' => 'zh-CN',
這樣就可以實現中文的資訊了!
ps:如果你用的laravel自帶的登入註冊,模板上顯示的還是英文,需要在lang資料夾下建立一個zh-CN.json檔案,檔案內容為
{ "Login": "登入", "Logout":"退出", "E-Mail Address": "郵箱", "Register":"註冊", "Password":"密碼", "Confirm Password":"確認密碼", "Name":"帳號", "Remember Me":"記住我", "Forgot Your Password?":"找回密碼", "Reset Password":"重置密碼", "Send Password Reset Link":"傳送重置郵件", "Reset Password Notification":"重置密碼通知", "You are receiving this email because we received a password reset request for your account.":"您收到這封郵件是因為我們收到您的帳戶密碼重置請求。", "If you did not request a password reset, no further action is required.":"如果沒有要求重新設定密碼,則不需要進一步的操作。" }
如下圖所示