If there is no message catalog for a given locale, for instance sv_SE, man will
show an annoying message like this:
Failed to open the message catalog "man" for locale "sv_SE"
(NLSPATH="/usr/share/locale/%L/%N")
Contrary to what the man manpage seems to indicate, I can't avoid this message
by having man search for english messages by setting LC_MESSAGES to an English
locale.
According to the man manpage LC_MESSAGES can be used to set the locale to use
for messages. If not LC_MESSAGES is set, then man will look for the value of
LANG instead. But currently man operates in the opposite way, looking for LANG
first and then LC_MESSAGES (or LC_ALL, which should override all other LC_*
variables).
Reproducible: Always
Steps to Reproduce:
set LANG to "sv_SE"
set LC_MESSAGES (or LC_ALL) to "en_US" (or any other locale - has no effect)
try to use a man page that doesn't exist
Actual Results:
Output:
Failed to open the message catalog "man" for locale "sv_SE"
(NLSPATH="/usr/share/locale/%L/%N")
What manual page do you want?
Expected Results:
Output:
What manual page do you want?
emerge info output follows:
Portage 2.0.49-r20 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r3, 2.4.24)
=================================================================
System uname: 2.4.24 i686 AMD Athlon(tm) processor
Gentoo Base System version 1.4.3.10
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=athlon -funroll-loops -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3.1/share/config /usr/kde/3/share/config /usr/share/config
/usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/
/var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-O3 -march=athlon -funroll-loops -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="http://gentoo.oregonstate.edu
http://distro.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X alsa apm arts avi berkdb bonobo cdr crypt cups directfb encode esd
foomaticdb gdbm gif gpm gtk2 imlib java jpeg kde libg++ libwww mad mikmod motif
mozilla mpeg mysql ncurses nls oggvorbis opengl oss pam pdflib perl png
postgres
python qt quicktime readline ruby sdl slang spell ssl svga tcpd tetex truetype
x86 xml2 xmms xv zlib linguas_sv"
Proposed fix - change the order in which man looks for locale related
environment variables to find message catalogs:
--- man-1.5l/src/gripes.c 2002-07-18 02:17:23.000000000 +0200
+++ man-1.5l/src/gripes.c 2004-01-09 22:37:17.000000000 +0100
@@ -41,11 +41,11 @@
and LANG != "en" (or when debugging). Also accept en_ZA etc. */
char *s, *lg;
s = getenv("NLSPATH");
- lg = getenv("LANG");
+ lg = getenv("LC_ALL");
if (!lg)
lg = getenv("LC_MESSAGES");
if (!lg)
- lg = getenv("LC_ALL");
+ lg = getenv("LANG");
if ((s || lg) && (!lg || strncmp(lg, "en", 2))) {
perror(mantexts);
fprintf(stderr,