使用者工具

網站工具


tech:centoslocale

CentOS 修改語系方式

  • 查看目前語系
    locale
  • 列出支援語系
    locale -a
  • 設定語系 Exp. zh_TW.utf8
    • 正常作法:
      localectl set-locale LANG=zh_TW.utf8
    • LXC 內作法:
      vi /etc/locale.conf
      LANG=zh_TW.utf8
  • 如果重開機候登入出現類似以下的錯誤訊息
    -bash: warning: setlocale: LC_CTYPE: cannot change locale (zh_TW.uft8): No such file or directory
    -bash: warning: setlocale: LC_COLLATE: cannot change locale (zh_TW.uft8): No such file or directory
    -bash: warning: setlocale: LC_MESSAGES: cannot change locale (zh_TW.uft8): No such file or directory
    -bash: warning: setlocale: LC_NUMERIC: cannot change locale (zh_TW.uft8): No such file or directory
    -bash: warning: setlocale: LC_TIME: cannot change locale (zh_TW.uft8): No such file or directory
  • 就編輯 /etc/environment 加上以下內容
    vi /etc/environment
    LANG=zh_TW.utf-8
    LC_ALL=zh_TW.utf-8

參考網址

tech/centoslocale.txt · 上一次變更: 2018/07/21 13:20 由 Jonathan Tsai