96

I recently came to git for a project I participate to. I found git gui rather handy (under OSX Snow Leopard) to srtat with but I would much like if it were not localized (in French, in my case). Is there preference or hack to have git gui displayed in english?

Vertexwahn
  • 7,709
  • 6
  • 64
  • 90

5 Answers5

92

For Windows users the are two choices as well:

1) Set the LANG environment variable to en.

a) Overall for Windows: http://www.itechtalk.com/thread3595.html

b) For the git shell only:

If you don't want to affect anything else except git applications you might add the following line in the beginning of C:\Program Files\Git\cmd\git.cmd file:

@set LANG=en

Please note that this will only work when launching commands from the git shell - GIT GUI launched from the start menu will not be affected

2) Delete or rename relevant *.msg file in C:\Program Files\Git\share\git-gui\lib\msgs

You save on not modifying any setup shell (especially if you use cmd.exe shells) but you lose on international functionality.

Credits: These answers originated in the official issue raised in msysgit project which can be found here: http://code.google.com/p/msysgit/issues/detail?id=302

Stefano
  • 18,083
  • 13
  • 64
  • 79
Oleg Sakharov
  • 1,127
  • 2
  • 20
  • 19
  • 5
    @set LANG=en in git.cmd had no effect for me. Both other options yes. I prefer setting the LANG environment variable. Thanks! – mono68 Aug 18 '11 at 12:39
  • 1
    An alternative to the git.cmd is to put the line `export LANG=en_US` in _c:\Program Files\git\etc\profile_ (this file is read when git bash starts). – Superole Oct 28 '13 at 11:30
  • Renaming the localization file in "C:\Program Files (x86)\Git\share\git-gui\lib\msgs" is by far the easiest solution. – bersanri Nov 04 '15 at 11:28
53

You could remove/rename the translation file from the install, french would be

... /share/git-gui/lib/msgs/fr.msg

Don't know about OS-X, but under windows (msysgit) that would normally be C:\Program Files\Git\share\git-gui\lib\msgs\, and on Linux (and others) /usr/share/git-gui/lib/msgs/ .

(and gitk ... /share/gitk/lib/msgs/ )

Joakim Elofsson
  • 36,326
  • 1
  • 22
  • 28
  • For reference: If you installed git via Homebrew on OS X, the path is: git-gui --> /usr/local/Cellar/git/[VERSION]/share/git-gui/lib/msgs and for gitk --> /usr/local/Cellar/git/[VERSION]/share/gitk/lib/msgs – Kai Mechel Dec 07 '14 at 17:01
10

For Linux you can use from a terminal:

LC_ALL=en_US.utf8 git gui

to start your git-gui for example temporary in english from your current terminal. This solution will affect only your current instance of git-gui and nothing else. Credit goes to Junio C Hamano

Update for use in *.desktop files (persistent solution):

To always start a program with the desired locale setting from your *.desktop file you have to modify it's Exec=... section to start in a modified environment.

From:

...
Exec="/usr/bin/your-program"
...

To:

...
Exec=env LC_ALL=en_US.utf8 "/usr/bin/your-program"
...

Update for missing locales:

Sometimes your system might complain with:

-bash: warning: setlocale: LC_ALL: cannot change locale (en_US)

In this case you most likely don't have the proper locale generated, yet. (If you see English text nevertheless it's probably your system that's using the C locale as a fallback)

Generating the missing locale:

  • How to in a Debian environment
  • How to in an Ubuntu environment
xmoex
  • 2,602
  • 22
  • 36
  • Where is the *.desktop file located ? – Gouvernathor Nov 01 '22 at 16:51
  • usually in /usr/share/applications/ or /usr/local/share/applications/ for applications installed system-wide, or ~/.local/share/applications/ for user-specific applications (from https://wiki.archlinux.org/title/desktop_entries#Application_entry ) – xmoex Nov 04 '22 at 16:35
  • The second doesn't exist on my end and the third is empty. I can't find anything named git or git-gui in the first. – Gouvernathor Nov 05 '22 at 22:41
  • usually there's none for git-gui... if you're looking for a persistent solution for git-gui specifically see Bengt's answer here: https://stackoverflow.com/questions/10633564/how-does-one-change-the-language-of-the-command-line-interface-of-git#answer-10872202 – xmoex Nov 06 '22 at 14:25
10

Note that setting @set LANG=en in cmd file helps, but only when you start GitGUI with that cmd file. This is not the case when you start it from the Start menu: it calls wish.exe directly. If you change the link to run cmd script, it shows text command window along with GUI, which is unwanted. That is why for me renaming .msg file is a way of choice.

Filip Radelic
  • 26,607
  • 8
  • 71
  • 97
Andrey Betenev
  • 109
  • 1
  • 2
9
export LANG=en_US

should do. It will affect everything you run from this shell, though.

Michael Krelin - hacker
  • 138,757
  • 24
  • 193
  • 173