So ändern Sie die Sprache in einer Befehlszeilen-Software unter Debian

20614
Amo__

Ich verwende 'Exif' auf einem Server (Debian GNU / Linux 6.0.6 (squeeze)) und im Gegensatz zu meinem Dev-Computer (Mac OS X bis MacPort) läuft es auf Französisch:

exif -h Utilisation: exif [OPTION...] fichier -v, --version Display software version -i, --ids Montre les ID plutôt que les noms des marqueurs -t, --tag=marqueur Sélection du marqueur --ifd=IFD Sélection de l'IFD -l, --list-tags Liste tous les marqueurs EXIF -|, --show-mnote Show contents of tag MakerNote --remove Supprime le marqueur ou l'ifd -s, --show-description Montre la description du marqueur -e, --extract-thumbnail Extrait la vignette -r, --remove-thumbnail Supprime la vignette -n, --insert-thumbnail=FICHIER Insère le FICHIER comme vignette --no-fixup Do not fix existing tags in files -o, --output=FICHIER Write data to FILE --set-value=STRING Value of tag -c, --create-exif Create EXIF data if not existing -m, --machine-readable Output in a machine-readable (tab delimited) format -w, --width=WIDTH Width of output -x, --xml-output Output in a XML format -d, --debug Show debugging messages 

Ich überprüfe mein / etc / default / locale und das war es

LANG=fr_FR LANGUAGE=fr_FR:fr 

in dem ich mich geändert habe

LANG=en_EN LANGUAGE=en_EN:en 

ohne Konsequenzen. Irgendein Hinweis, wie man diesen Machin zwingt, diese Software auf Englisch auszuführen? Weil ich Exif-Datenetiketten in Englisch haben muss :)

Vielen Dank !

2

1 Antwort auf die Frage

4
kostix

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.

Auf diese Weise können Sie die Sprachen in einer Debian-basierten Distribution ändern. jeremiah vor 11 Jahren 0
Vielen Dank. Jetzt ist mein Exif auf Englisch :) Ich habe die Dpkg-Rekonfiguration durchgeführt, falls gestern Vars in / etc / default / locale falsch eingegeben wird. Amo__ vor 11 Jahren 0