/etc/locale.gen:没有这样的文件或目录,我该如何以正确的方式添加新的语言环境

/etc/locale.gen:没有这样的文件或目录,我该如何以正确的方式添加新的语言环境

该文件/etc/locale.gen不存在于我的 Ubuntu 14.04 LTS 上,我该如何以正确的方式添加新的语言环境?

答案1

要添加新的语言环境,您必须将其添加到/etc/locale.gen,保存文件并运行以下命令:

sudo locale-gen

但您的系统上缺少这个文件,这确实很奇怪。

为美式英语添加此项:

en_US.UTF-8 UTF-8

答案2

/etc/locale.gen 以注释格式包含所有本地设置和系统语言。

要添加/etc/locale.gen正确的方法,请运行命令

$ sudo apt install locale-gen --reinstall

输出将是

$ sudo apt install locales --reinstall
  Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  Need to get 3,612 kB of archives.
  After this operation, 0 B of additional disk space will be used.
  Get:1 http://in.archive.ubuntu.com/ubuntu bionic/main amd64 locales all 2.27-3ubuntu1 [3,612 kB]
  Fetched 3,612 kB in 17s (213 kB/s)                                                                                                                                                           
  Preconfiguring packages ...
  (Reading database ... 264543 files and directories currently installed.)
  Preparing to unpack .../locales_2.27-3ubuntu1_all.deb ...
  Unpacking locales (2.27-3ubuntu1) over (2.27-3ubuntu1) ...
  Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
  Setting up locales (2.27-3ubuntu1) ...
  Generating locales (this might take a while)...
  en_AG.UTF-8... done
  en_AU.UTF-8... done
  en_BW.UTF-8... done
  en_CA.UTF-8... done
  en_DK.UTF-8... done
  en_GB.UTF-8... done
  en_HK.UTF-8... done
  en_IE.UTF-8... done
  en_IL.UTF-8... done
  en_IN.UTF-8... done
  en_NG.UTF-8... done
  en_NZ.UTF-8... done
  en_PH.UTF-8... done
  en_SG.UTF-8... done
  en_US.UTF-8... done
  en_ZA.UTF-8... done
  en_ZM.UTF-8... done
  en_ZW.UTF-8... done
  Generation complete.

了解更多信息 -https://renenyffenegger.ch/notes/Linux/locale

相关内容