Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to see localized error messages. However, I only seem to get the message from the default "C" locale. E.g.

$ cat /etc/shadow
cat: /etc/shadow: Permission denied

$ locale -a|grep fi

$ LC_MESSAGES=fi_FI.utf8 cat /etc/shadow
cat: /etc/shadow: Permission denied

Furthermore, looking at the ltrace output of cat it does call setlocale(LC_ALL, ""), and prints the error message with the glibc error() function (which prints the error message returned by strerror(), which should be a localized message).

Looking at the strace output of "LC_MESSAGES=fi_FI.utf8 cat /etc/shadow" one sees that it tries to open the libc message catalog, but for the english locale rather than fi_FI.utf8:

open("/usr/share/locale/en_US/LC_MESSAGES/", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US/LC_MESSAGES/", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en/LC_MESSAGES/", O_RDONLY) = -1 ENOENT (No such file or directory)

I do have a file /usr/share/locale-langpack/fi/LC_MESSAGES/ which contains the libc message catalog for the fi_FI.utf8 locale, however, it doesn't seem to be used. Packages language-pack-fi, language-pack-fi-base are both installed (as are the corresponding gnome and kde language packs, but I can't see them being relevant here).

What am I missing?

share|improve this question
see also… – Takkat Nov 28 '13 at 11:13
up vote 1 down vote accepted

You are missing the LANGUAGE environment variable, which is set in Ubuntu more often than not, and overrides LC_MESSAGES for GNU compatible programs.


LANGUAGE=fi cat /etc/shadow
share|improve this answer
Right, that was it. Thanks! – janneb Nov 28 '13 at 10:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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