如何修复 Manjaro 上丢失的语言环境文件?

如何修复 Manjaro 上丢失的语言环境文件?

我正在运行 Manjaro Gnome 并使用包管理器安装了一些更新。从那时起,我不断在控制台中收到这些消息:

manpath: can't set the locale; make sure $LC_* and $LANG are correct
(anon):12: character not in range
manpath: can't set the locale; make sure $LC_* and $LANG are correct

运行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=en_US.UTF-8
LC_CTYPE=
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=en_US.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=en_US.UTF-8
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT=en_US.UTF-8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

当我运行时,sudo locale-gen我收到一条错误消息,指出文件或目录不存在

Generating locales...
  de_DE.UTF-8...failed to set locale!
[error] cannot open locale definition file `i18n_ctype': No such file or directory

当我注释掉(那么唯一没有注释掉的行是)de_DE.UTF-8 UTF-8时,我得到:/etc/locale.genen_US.UTF-8 UTF-8

Generating locales...
  en_US.UTF-8...failed to set locale!
[error] cannot open locale definition file `en_GB': No such file or directory

这是以下内容/usr/share/i18n/locales

de_DE                  translit_combining
en_US                  translit_compat
i18n                   translit_font
iso14651_t1            translit_fraction
iso14651_t1_common     translit_hangul
iso14651_t1_pinyin     translit_narrow
translit_circle        translit_neutral
translit_cjk_compat    translit_small
translit_cjk_variants  translit_wide

所以看起来文件en_GBi18n_ctype确实丢失了(尽管我不确定它们是否应该在这个文件夹中)

另外,如果我去设置->地区和语言,我无法改变语言(它说Unspecified [ANSI_X3.4-1968]。如果我点击它,则在选择语言弹出窗口。

我在网上发现问题可能出在glibc(并且根据历史记录,glibc在我运行的更新期间重新安装了[2020-08-11T18:49:33+0200] [ALPM] reinstalled glibc (2.31-5))。但是,我不知道如何解决这个问题。包管理器中没有 glibc 的重新安装按钮,我不想做任何可能导致更大混乱的实验。

有没有办法重新安装/重置语言文件?

更新

我使用NoExtractin/etc/pacman.conf来节省硬盘空间,如 [Arch wiki] 中所述(https://wiki.archlinux.org/index.php/Pacman/Tips_and_tricks#Installing_only_content_in_required_languages

NoExtract = usr/share/help/* !usr/share/help/en*
NoExtract = usr/share/gtk-doc/html/*
NoExtract = usr/share/locale/* usr/share/X11/locale/* usr/share/i18n/* opt/google/chrome/locales/*
NoExtract = !*locale*/en*/* !usr/share/i18n/charmaps/UTF-8.gz !usr/share/*locale*/locale.*
NoExtract = !usr/share/*locales/en_US !usr/share/*locales/i18n !usr/share/*locales/iso*
NoExtract = !usr/share/*locales/trans*
NoExtract = !*locale*/de*/* !usr/share/i18n/charmaps/UTF-8.gz !usr/share/*locale*/locale.*
NoExtract = !usr/share/*locales/de_DE !usr/share/*locales/i18n !usr/share/*locales/iso*
NoExtract = !usr/share/*locales/trans*
NoExtract = usr/share/qt4/translations/*
NoExtract = usr/share/man/* !usr/share/man/man*
NoExtract = usr/share/vim/vim*/lang/*
NoExtract = usr/lib/libreoffice/help/en-US/*

我想知道这是否是问题的一部分,也许重新安装 glibc 时跳过了一些文件。

答案1

  1. 编辑/etc/locale.gen

    取消注释该行:

    locale en_US.UTF-8
    
  2. 跑步sudo locale-gen

信用:https://nanxiao.me/en/fix-locale-configuration-issue-on-arch-linux/

答案2

我现在找到了解决方案。我不认为这是最好的方法,但它似乎对我有用。

我下载了glibc包并手动将丢失的文件(en_GBi18n_ctype)复制到/usr/share/i18n/locales/.

然后运行sudo locale-gen

答案3

/etc/locale.gen您可以通过重新安装软件包来取回您的信息glibc。这将在安装时生成一个新文件。

答案4

就我而言,问题是由KDE Plasma Settings Manager- 将区域设置配置为不存在的配置引起的。

在 Manjaro 安装过程中,我选择了Finland/English那里,因为它可用。为什么不?它决定了fi_EN.UTF-8这至少是无稽之谈,因为glibc不包含这样的组合。

您可以列出glibc检查其包文件的语言,如下所示:

pacman -Ql glibc | grep fi_

在我的例子中显示了这两个:

glibc /usr/share/i18n/locales/fi_FI
glibc /usr/share/i18n/locales/fi_FI@euro

fi_FI是正确的,而不是fi_EN两者都正确fi_US。等离子,你真丢脸。

替换grep fi_上面命令中的 来查找您的语言,例如波兰语:grep pl_、德语:grep de_等。

locale然后将其与命令调用的结果进行比较。就我而言,我需要通过编辑来纠正它/etc/locale.gen。您可以按照 Manjaro 的故障排除:

https://wiki.manjaro.org/index.php/Locale

或者更确切地说,在 Holly Arch Wiki 中:

https://wiki.archlinux.org/title/locale

相关内容