Please enable Javascript to view the contents

locale

 ·  ☕ 1 分钟
  1. Introduction
    When you are using the terminal and encounter the following warning promtp like warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8), you can not figure it out and you are most likely confused, this article would help you solve this problem.

  2. Solution

1
sudo locale

Edit the configuration file for locale-gen:

1
sudo vim /etc/locale.gen

This file lists locales that you wish to have built. You can find a list of valid supported locales at /usr/share/i18n/SUPPORTED, and you can add user defined locales to /usr/local/share/i18n/SUPPORTED. If you change this file, you need to rerun locale-gen.

Add or uncomment the locale en_US.UTF-8 UTF-8 and rerun locale-gen:

1
sudo locale-gen
  1. Conclusion
    This error happens when your terminal settings local locale environment variables which doesn’t have the specific locale you requested, to solve this problem you should configure and generate the locales.