I was trying to install Chinese language support for a Fedora 26 Server hosted on Digital Ocean, multiple steps have been taken but I still couldn't get it right.

The language and charset I was trying to install is zh_CN.UTF-8

Solutions taken so far:

  • Setting %_install_langs all (which was previously %_install_langs C:en:en_US:en_US.UTF-8 as the cloud provider default) in /etc/rpm/macros.image-language-conf, and then $ dnf reinstall glibc-common, according to this Super User post linux - How do I install/generate all locales on Fedora?.

  • Installing langpacks-zh_CN using $ dnf install langpacks-zh_CN.

  • Installing glibc-langpack-zh and man-pages-zh-CN, both of which are weak dependencies of langpacks-zh_CN, and somehow the latter is not installed when installing langpacks-zh_CN.

  • Setting LANG=zh_CN.UTF-8 and LC_ALL=zh_CN.UTF-8 in /etc/locale.conf.

  • Setting export LANG=zh_CN.UTF-8 and export LC_ALL=zh_CN.UTF-8 in ~/.bashrc.

What have been different:

  • When using $ date, the prompt is now in correct language as 2017年 10月 20日 星期五 18:31:34 UTC.

  • However, anything else is still English, including man prompts, dnf prompts, nano prompts, etc.

  • But the same commands work perfectly well on a local Fedora Server VM.

Noticed situation: (but not sure if there are right or how to solve)

  • I found/usr/share/locale/zh_CN/LC_MESSAGES has fewer files in comparison with the VM on my Mac. While the VM on my Mac has tens of files in the folder (the translation project has been there for years), the cloud remote Droplet has only 1, and that is libc.mo.

After changing the settings as you have, you'll need to dnf reinstall any packages which are missing translations (not everything uses the langpacks feature yet). For example:

dnf reinstall dnf

and then you'll have translations for DNF. Repeat this for any other packages which are missing translations.

This will also happen as bugfix and security updates come in for the packages, and of course any new packages which come in after you've made the config change will bring translations along.

| improve this answer | |
  • Wow! That was mind-blowning! Definitely didn't think of reinstalling dnf! And Chinese now works of dnf! – jackxujh Oct 21 '17 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.