错误:在 Linux Mint 上生成语言环境时,错误条目“en_AG”等

错误:在 Linux Mint 上生成语言环境时,错误条目“en_AG”等

我不确定那些“坏地方”发生了什么,我每天定期更新一次我的笔记本电脑。今天出现了这个:

Setting up locales (2.35-0ubuntu3.4) ...
Generating locales (this might take a while)...
  cs_CZ.UTF-8... done
error: Bad entry 'en_AG '
  en_AG.UTF-8... done
  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
error: Bad entry 'en_IL '
  en_IL.UTF-8... done
  en_IL.UTF-8... done
error: Bad entry 'en_IN '
  en_IN.UTF-8... done
  en_IN.UTF-8... done
error: Bad entry 'en_NG '
  en_NG.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
error: Bad entry 'en_ZM '
  en_ZM.UTF-8... done
  en_ZM.UTF-8... done
  en_ZW.UTF-8... done
  sk_SK.UTF-8... done
Generation complete.

我找到了一个文件,其中列出了以下条目:

$ cat /var/lib/locales/supported.d/en
en_HK.UTF-8 UTF-8
en_DK.UTF-8 UTF-8
en_IN UTF-8
en_IL UTF-8
en_ZM UTF-8
en_ZW.UTF-8 UTF-8
en_NZ.UTF-8 UTF-8
en_PH.UTF-8 UTF-8
en_NG UTF-8
en_US.UTF-8 UTF-8
en_GB.UTF-8 UTF-8
en_AU.UTF-8 UTF-8
en_SG.UTF-8 UTF-8
en_BW.UTF-8 UTF-8
en_AG UTF-8
en_ZA.UTF-8 UTF-8
en_CA.UTF-8 UTF-8
en_IE.UTF-8 UTF-8

UTF-8在缺少和运行的地方添加关键字sudo locale-gen没有帮助,它显示手动添加关键字的位置:

...Try `localedef --help' or `localedef --usage' for more information.

PS:我使用的是 Linux Mint 21.2 (Victoria) Cinnamon,我可以在此处编辑已安装的语言:

Linux Mint 上安装的语言


任何帮助表示赞赏!


今天我尝试了sudo dpkg-reconfigure locales但没有运气。

答案1

谢谢唐克里斯斯蒂的评论引导我找到这个答案,我发现了其中的价值,我现在知道有一个特定于我的发行版(Linux Mint)的文件:

/var/lib/locales/supported.d/mintlocale

其中包含以下内容:

cs_CZ.UTF-8 UTF-8
en_AG
en_AG.UTF-8 UTF-8
en_AU.UTF-8 UTF-8
en_BW.UTF-8 UTF-8
en_CA.UTF-8 UTF-8
en_DK.UTF-8 UTF-8
en_GB.UTF-8 UTF-8
en_HK.UTF-8 UTF-8
en_IE.UTF-8 UTF-8
en_IL
en_IL.UTF-8 UTF-8
en_IN
en_IN.UTF-8 UTF-8
en_NG
en_NG.UTF-8 UTF-8
en_NZ.UTF-8 UTF-8
en_PH.UTF-8 UTF-8
en_SG.UTF-8 UTF-8
en_US.UTF-8 UTF-8
en_ZA.UTF-8 UTF-8
en_ZM
en_ZM.UTF-8 UTF-8
en_ZW.UTF-8 UTF-8
sk_SK.UTF-8 UTF-8

另外,我在问题中提到的文件/var/lib/locales/supported.d/en包含:

en_HK.UTF-8 UTF-8
en_DK.UTF-8 UTF-8
en_IN UTF-8
en_IL UTF-8
en_ZM UTF-8
en_ZW.UTF-8 UTF-8
en_NZ.UTF-8 UTF-8
en_PH.UTF-8 UTF-8
en_NG UTF-8
en_US.UTF-8 UTF-8
en_GB.UTF-8 UTF-8
en_AU.UTF-8 UTF-8
en_SG.UTF-8 UTF-8
en_BW.UTF-8 UTF-8
en_AG UTF-8
en_ZA.UTF-8 UTF-8
en_CA.UTF-8 UTF-8
en_IE.UTF-8 UTF-8

解决方案:

  1. 正如您亲眼所见,有一些奇怪的行没有任何编码。我在上面的文件中注释掉了这些行。

  2. 在另一个文件中,确保xx_YY.UTF-8 UTF-8所有行的格式如下:

现在我可以运行locale-gen而不会出现任何错误。

相关内容