:::

4-2 為樣板製作中文語系檔

  1. nav.blade.php樣板檔中,會看到如{{ __('Login') }}這樣的用法,這表示此字串是可以翻譯成其他語系的。
  2. 先建立/專案/resources/lang/zh-TW.json語系檔
  3. 在VSCode中按Ctrl+Shift+F即可跨檔案搜尋,可輸入__('來搜尋所有有語系的部份。
  4. 將字串翻譯寫入zh-TW.json語系檔中(JSON格式):
    {
        "Login": "登入",
        "Password": "密碼",
        "Remember Me": "記住我",
        "E-Mail Address": "電子郵件",
        "Forgot Your Password?": "忘記密碼?",
        "Verify Your Email Address": "驗證您的電子郵件地址",
        "A fresh verification link has been sent to your email address.": "新的驗證連結已發送到您的電子郵件地址",
        "Before proceeding, please check your email for a verification link.": "在繼續之前,請檢查您的電子郵件以獲取驗證鏈接。",
        "If you did not receive the email": "如果您沒有收到該電子郵件",
        "click here to request another": "點擊這裡申請另一個",
        "Reset Password": "重設密碼",
        "Send Password Reset Link": "寄送重設密碼連結",
        "Confirm Password": "確認密碼",
        "Toggle navigation": "縮放導覽工具",
        "Register": "註冊",
        "Name": "姓名",
        "Logout": "登出"
    }
    
  5. 如此,http://myshop.test/login 界面就會變成中文的囉!
  6. 詳情請看:https://learnku.com/docs/laravel/5.8/localization/3903#retrieving-translation-strings

到GitHub觀看此單元程式異動


:::

書籍目錄

展開 | 闔起

http%3A%2F%2Fcampus-xoops.tn.edu.tw%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D1392%26tbsn%3D43

計數器

今天: 972972972
昨天: 2815281528152815
總計: 7866085786608578660857866085786608578660857866085