Как изменить язык в программном обеспечении командной строки на Debian

20442
Amo__

я использую 'exif' на сервере (Debian GNU / Linux 6.0.6 (squeeze)) и в отличие от моего компьютера разработчика (Mac OS X через MacPort) он работает на французском языке:

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 

Я проверяю мой / etc / default / locale, и это было

LANG=fr_FR LANGUAGE=fr_FR:fr 

который я изменил в

LANG=en_EN LANGUAGE=en_EN:en 

без каких-либо последствий. Любой намек на то, как заставить эту машину выполнять эту программу на английском языке? Потому что мне нужны ярлыки exif-data на английском языке :)

Спасибо !

2

1 ответ на вопрос

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.

Это способ изменить язык в дистрибутиве на основе Debian. jeremiah 11 лет назад 0
Большое спасибо. Теперь мой exif на английском языке :) Я сделал dpkg-переконфигурирование, на случай, если вчера были введены опечатки в / etc / default / locale. Amo__ 11 лет назад 0

Похожие вопросы