tags:

views:

43

answers:

2

I just installed Mercurial 1.6 on my MacBook running Mac OS X 10.5.8

"hg" shows me help text in what appears to be a random mix of English and German, "hg -v" shows text all in German. Why?

I am, in fact, in Germany and my Mac has a German keyboard. I have Germany as the system locale but English as the language.

I speak fluent German, so having hg speak to me in German is not an insurmountable problem. But English is my native language and the language I prefer to work in.

Anybody know how to override this irritating behaviour of hg?

+3  A: 

You need to set an environment variable, otherwise it defaults to the locale of your user.

The variable should be named LANG and it should have the value en_US to give you English (US) texts.

Results on Windows (I know, you're on Mac but I don't know how to do it there):

[C:\] :set lang=de_DE

[C:\] :hg version
Mercurial Distributed SCM (version 1.6.1023)

Copyright (C) 2005-2010 Matt Mackall <[email protected]> und andere
Dies ist freie Software; siehe Quellen fⁿr Kopierbestimmungen. Es besteht
KEINE GewΣhrleistung fⁿr das Programm, nicht einmal der Marktreife oder der
Verwendbarkeit fⁿr einen bestimmten Zweck.

[C:\] :set lang=en_US

[C:\] :hg version
Mercurial Distributed SCM (version 1.6.1023)

Copyright (C) 2005-2010 Matt Mackall <[email protected]> and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[C:\] :
Lasse V. Karlsen
+1  A: 

Thanks Lasse: your answer put me on the right path.

Mac OS X, even though I've set the language in Sytem Preferences/International to English, still has "LANG=de_DE.UTF-8" in the command line environment. [OS X bug?]

I'm not sure if overriding this globally might break anything, though, so I "fixed" it for now with a little script called "hg" in my utils directory, placed in my path before the real thing, that overrides LANG before calling the real hg:

LANG="en_EN.UTF-8"
REALHG=$(which hg)
$REALHG $@

... which works on OS X despite my sub-rudimentary shell scripting skills, but depends on odd behaviour of "which" on OS X. On OS X, "which" does indeed find the "real" hg. On Linux, otoh, this script finds itself again and goes into infinite recursion.

AlanL