Mathieu Basille
Mathieu Basille

Reputation: 171

Git messages in English (in all applications, not bash only)

I am currently using Emacs + Magit, but I guess my question is more general than the specific use of these software. I've read How does one change the language of the command line interface of Git? on SO, but it only gives an appropriate answer for the use of Git CLI in a bash.

My question is thus simple: Is there a solution to use a specific locale (in my case en_US) for Git to use in every application, in particular outside of the bash?

For the case of Magit, there is a workaround from within Emacs, but it still creates other problems (e.g. starting R/ESS from Emacs, I now get warnings such as: "1: Setting LC_CTYPE failed, using "C"").

I checked the doc for git-config and the configuration of Git, but I could not find anything related to localization. I was actually looking for something similar as lc_messages = 'en_US.UTF-8' that you can use with PostgreSQL (in postgresql.conf), and found it surprising that there does not seem to be a similar approach for Git.


Edit: The question here is really about changing the specific locale of Git, and only Git, and outside of a shell. For instance, running LANG=en_US emacs in a shell, as suggested by michas, set the locale for all applications run in the shell and, obviously, involves a shell. I'm really looking for a solution similar to the approach of PostgreSQL, e.g. via configuration files.


Edit2: My system is Debian Jessie (current testing), with fr_FR as default locale, and do include en_US in the list of locales:

$ locale -a
C
C.UTF-8
en_US.utf8
fr_CA.utf8
fr_FR.utf8
POSIX

Upvotes: 3

Views: 628

Answers (1)

michas
michas

Reputation: 26545

You need to set your locale properly.

Type locale -a to show all available locales.

Type locale to show you current setting.

You have different ways to set your locale. Either set it from your shell when starting your application like LANG=en_US emacs or you set it for all command of your shell using export LANG=en_US.

If you want to change the locale for your whole system you can set some system config file, but this is distribution specific.

Be aware that locale -a must list en_US to be able to use this locale. The generation of locales is also distribution specific.

Upvotes: 1

Related Questions