9

Am I correct in my assumption that shell commands such as cp, man, ls, etc. always print their messages in English regardless of system and user settings, and also standard shell messages like "command not found" are not localizable?

In System Preferences > Language & Text, I tried changing language, region and input source to a different language/locale. I also tried running sudo languagesetup. Nothing seems to affect the language of shell commands, so I guess it must hard coded to English, but I couldn't find any reference on the internet. If this is not correct, how do you change the shell language in OS X?

7

If you change LC_MESSAGES, it changes the language of error and help messages shown by bash, but only a part of them are translated for many languages:

$ export LC_MESSAGES=de_DE.UTF-8
$ aa
bash: aa: Kommando nicht gefunden.
$ help alias
alias: alias [-p] [Name[=Wert] ... ]
    Definiert Aliase oder zeigt sie an.

    Ohne Argumente wird die Liste der Aliase (Synonyme) in der Form
    `alias Name=Wert' auf die Standardausgabe gedruckt.

    Sonst wird ein Alias für jeden angegebenen Namen definiert, für den ein
    Wert angegeben wurde.
    A trailing space in VALUE causes the next word to be checked for
    alias substitution when the alias is expanded.

    Options:
      -p    Print all defined aliases in a reusable format

    Rückgabewert:
    Meldet Erfolg, außer wenn NAME nicht existiert.

Terminal and iTerm 2 set LANG (which changes all actual locale variables like LC_MESSAGES) based on the region selected in System Preferences by default.

Some GNU/Linux distributions come with man pages in other languages than English, but OS X doesn't. Some Homebrew packages add localized man pages to /usr/local/share/man/ though:

$ LC_MESSAGES=de_DE.UTF-8 man -w ps2pdf
/usr/local/share/man/de/man1/ps2pdf.1
$ LC_MESSAGES=de_DE.UTF-8 man ps2pdf|head
PS2PDF(1)                         Ghostscript                        PS2PDF(1)



NAME
       ps2pdf - konvertiert PostScript nach PDF mittels ghostscript
       ps2pdf12 - konvertiert PostScript nach PDF 1.2 (kompatibel zu Acrobat 3
       und spAxter) mittels ghostscript
       ps2pdf13 - konvertiert PostScript nach PDF 1.3 (kompatibel zu Acrobat 4
       und spAxter) mittels ghostscript

You could for example copy /usr/share/man/de/ from a Ubuntu VM to OS X, but only a small part of the man pages are translated:

ubuntu:~$ find /usr/share/man/de -type f|wc -l
113
ubuntu:~$ find /usr/share/man/man* -type f|wc -l
2857
  • 1
    In a plain bash 3.2 on Mountain Lion, setting LC_MESSAGES wouldn't change the language of any messages. The messages in German must be probably a Homebrew addition. – GOTO 0 Sep 2 '13 at 13:01
  • @ft1 Oh, you're right. I'm using bash 4.2. Maybe those translations were added in bash 4.0 or later or maybe they were not included in the version of bash 3.2 that is included with OS X. – Lri Sep 3 '13 at 7:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .