Debian

找不到語言環境/設置語言環境失敗 - 我該怎麼辦?

  • March 1, 2022

我已經在我的 VPS (OpenVZ) 上安裝了 Debian 7 i386。一切正常,除了語言環境 - 任何安裝任何東西的嘗試都顯示:

[...]
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
   LANGUAGE = (unset),
   LC_ALL = (unset),
   LANG = "pl_PL.UTF-8"
   are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
[...]

我試過的:

  1. 自己生成語言環境 - update-locale LC_ALL="pl_PL.UTF-8"- 顯示:http ://www.wklej.org/id/1248438/
  2. apt-get install --reinstall locales http://www.wklej.org/id/1248442/
  3. dpkg-reconfigure locales+ 設置相同pl_PL.UTF-8pl_PL.ISO-8859-2甚至en_UShttp ://www.wklej.org/id/1248446/
  4. export LC_ALL=pl_PL.UTF-8(即使在根上):
-bash: warning: setlocale: LC_ALL: cannot change locale (pl_PL.UTF-8)

這是顯示語言環境的內容:

root:~# locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=pl_PL.UTF-8
LANGUAGE=
LC_CTYPE="pl_PL.UTF-8"
LC_NUMERIC="pl_PL.UTF-8"
LC_TIME="pl_PL.UTF-8"
LC_COLLATE="pl_PL.UTF-8"
LC_MONETARY="pl_PL.UTF-8"
LC_MESSAGES="pl_PL.UTF-8"
LC_PAPER="pl_PL.UTF-8"
LC_NAME="pl_PL.UTF-8"
LC_ADDRESS="pl_PL.UTF-8"
LC_TELEPHONE="pl_PL.UTF-8"
LC_MEASUREMENT="pl_PL.UTF-8"
LC_IDENTIFICATION="pl_PL.UTF-8"
LC_ALL=

在 /var/log 中沒有發現任何有趣的東西。即使將 repo 更改為官方 + purge 和手動安裝語言環境也不能解決我的問題,這在每次全新安裝 Debian 7 時都會表現出來。

似乎沒有生成任何語言環境。您是否通過按相應的行pl_PL.UTF-8正確選擇了?dpkg-reconfigure locales``space

如果是,則行

pl_PL.UTF-8 UTF-8

in/etc/locale.gen沒有註釋(= 不以 開頭#)。如果您需要解決此問題,您還需要執行locale-gen以生成語言環境。它的輸出應該是:

Generating locales (this might take a while)...
  pl_PL.UTF-8... done
Generation complete.

如果它沒有輸出您要生成的語言環境,那麼您的系統似乎有問題。一個原因可能是您已localepurge安裝。如果沒有文件,/usr/share/locale/pl/LC_MESSAGES或者/usr/share/locale/pl_PL/LC_MESSAGES是這種情況,或者您的系統已損壞。

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