Locale

centos6 中的 locale-gen 命令

  • July 3, 2014

在我的裸 centos6.5 系統中,它是一個docker容器,en_US.utf-8缺少語言環境:

bash-4.1# locale -a
C
POSIX

通常在 Ubuntu 中有locale-gen執行此操作的命令:

# locale-gen en_US.UTF-8
# echo 'LANG="en_US.UTF-8"' > /etc/default/locale

我怎樣才能在centos 6.5中做到這一點?

locale-gen中不存在Centos/Fedora

您必須使用localedef

localedef -v -c -i en_US -f UTF-8 en_US.UTF-8

來自man localedef

NAME
      localedef - define locale environment

SYNOPSIS
      localedef [-c][-f charmap][-i sourcefile][-u code_set_name] name

DESCRIPTION
      The localedef utility shall convert source definitions for locale cate‐
      gories into a format usable by the functions and utilities whose opera‐
      tional behavior is determined by the setting of the locale  environment
      variables    defined    in    the    Base    Definitions    volume   of
      IEEE Std 1003.1-2001, Chapter 7, Locale. It  is  implementation-defined
      whether users have the capability to create new locales, in addition to
      those  supplied  by  the  implementation.  If  the  symbolic   constant
      POSIX2_LOCALEDEF  is  defined,  the system supports the creation of new
      locales.    On   XSI-conformant   systems,   the   symbolic    constant
      POSIX2_LOCALEDEF shall be defined.

引用自:https://unix.stackexchange.com/questions/140299