How to change language in a command-line software on debian

The /etc/default/locale file sets uhm... "global" defaults. That means, these defaults are read by any "top-level" shell when it starts up, and is then inherited by processes it runs.

Long story short, this means such defaults are applied to:

  • All daemons (programs running in background) as they're started using shell scripts located in /etc/init.d.
  • Interactive shells you run in your login session.

So merely changing that file requires a reboot.

But, as the contents of that file is just a shell script that sets a bunch of the so-called "environment variables", to effect one particular program you just have to make that program see different contents of these variables.

The simlest way to achieve this is to just put their assignment before the program to run, that is, at your shell prompt you can do:

$ LANG=en exif -h

and see exif talking to you in English (the $ character here denotes a shell prompt -- do not type it).

The second way is to make all the programs in the current shell see the new contents of the variables; this is done via "exporting" them, as @clarkw showed: an exported variable and its contents is inherited by the environment of all the processes run from the shell, so the following also works:

$ export LANG=en
$ exif -h

or

$ LANG=en
$ export LANG
$ exif -h

These environment variables are described in the locale(1) manual page.

And the last tip: do not change the contents of /etc/default/locale by hand — use the Debian way to manage it: run

# dpkg-reconfigure locales

which will first ask you which locales to compile and install (you can skip this step) and then which one to pick as the default.

Update: here's a page on the Debian wiki dedicated to locales which pretty much explains everything needed including the environment variables.