2

My Ubuntu 18.04 is set to Spanish:

enter image description here

But man pages are displayed in English, not according to the configuration (Spanish).

$ man cp | head -n4
CP(1)                            User Commands                       CP(1)

NAME
   cp - copy files and directories

The following is what I tried to get man page in Spanish:

$ LANG=es_ES.utf8 man cp   # result is in English
$ LANGUAGE=es_ES:es man cp # result is in English
$ man -Les cp              # result is in English
$ man --locale=es cp       # result is in English

To verify es_ES is correctly installed:

$ locale -a | grep es_ES
es_ES.utf8

To verify the man pages for Spanish is installed:

$ sudo dpkg -l | grep language-pack-es
ii  language-pack-es                           1:18.04+20180712                             
all          translation updates for language Spanish; Castilian
ii  language-pack-es-base                      1:18.04+20180712                             
all          translations for language Spanish; Castilian

To force re-creating man pages

$ sudo mandb -c

After all of these, try the first 3 commands and none of them produces man pages in Spanish.


References:

None of the solutions here work:

How can I read man pages in my native language? https://unix.stackexchange.com/questions/283660/how-to-change-the-language-for-man-command https://unix.stackexchange.com/questions/43384/localization-of-man-pages-on-linux-ubuntu

3

man takes the -L option as well as environment variables as $LC_MESSAGES and $LANG into account, but it can’t display man pages in a language they are not (yet?) translated to. Using find we can easily get a list of available translations, e.g. for cp:

$ find /usr/share/man -name "cp.*"
/usr/share/man/man1/cp.1.gz

That means there’s only one version, not located in any of the language subdirectories, that’s the default English one. Let’s take a look at results for the man command:

$ find /usr/share/man -name "man.*"
/usr/share/man/nl/man1/man.1.gz
/usr/share/man/zh_CN/man1/man.1.gz
/usr/share/man/ru/man1/man.1.gz
/usr/share/man/ja/man1/man.1.gz
/usr/share/man/sv/man1/man.1.gz
/usr/share/man/sr/man1/man.1.gz
/usr/share/man/es/man1/man.1.gz
…

The list goes on and shows the available languages, es being one of them. You can use one of

LANGUAGE=es_ES.utf8 man man
man -L es_ES.utf8 man
man -Les man

to display it. In fact, if the locale environment variables in your terminal are set accordingly man will always display man pages in Spanish and only fall back to English if a Spanish translation is not available, like you experienced with man cp. To set this up, run locale and see if $LANGUAGE is set to es_ES.utf8. If it’s not, add a line LANGUAGE=es_ES.utf8 to your ~/.bashrc or define an alias like alias man='man -Les'.

Catering to waltinators answer there may be additional packages available holding translations, you can take a look at their file lists on https://packages.ubuntu.com or with e.g. apt-file list manpages-es. manpages-es and manpages-es-extra look promising, however none of them contains a man page for the cp command.

1

Since not everybody has disk space for every-language man pages, and since the LANG variable doesn't cause translation, you probably need to install one or more packages:

$ apt-cache search Spanish|grep man
aptitude-doc-es - Spanish manual for aptitude, a terminal-based package manager
drascula-german - classic 2D point and click adventure game -- German version
drgeo-doc - Dr. Geo online user manual
manpages-es - Spanish man pages
manpages-es-extra - Spanish extra manpages
apertium-es-ro - Apertium translation data for the Spanish-Romanian pair

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.