threads / discuss / 25604

git-gui appears to not respect Windows 7 settings on Display Language.

Subject: git-gui appears to not respect Windows 7 settings on Display Language.

## tl;dr

3 messages between Oct 31, 2010 and Nov 2, 2010.

replies: 2people: 3as markdown or json

Michael Menegakis· Oct 31, 2010, 19:53 UTC · lore

For some unknown sorcery Microsoft does not refer to 'Locale' the same as UNIX. There is only a display-characters method, only if a character set is not unicode. For actual display of language they have now on 7 a package downloading mechanism to have the whole system show a language.

On 7 right now I have locale on Greek so that any non-unicode programs will work with that. But the display language is English and no Greek or other non-English package has been installed. The location is also Greece but that doesn't affect other programs either.

In general these settings make almost all programs to display English by default. Only a minority like git-gui don't.

Konstantin Khomoutov· Nov 1, 2010, 00:23 UTC · re: Michael Menegakis · lore

Re: git-gui appears to not respect Windows 7 settings on Display Language.

On Sun, Oct 31, 2010 at 09:53:37PM +0200, Michael Menegakis wrote:
Show 13 quoted lines
> For some unknown sorcery Microsoft does not refer to 'Locale' the same
> as UNIX. There is only a display-characters method, only if a
> character set is not unicode. For actual display of language they have
> now on 7 a package downloading mechanism to have the whole system show
> a language.
> 
> On 7 right now I have locale on Greek so that any non-unicode programs
> will work with that. But the display language is English and no Greek
> or other non-English package has been installed. The location is also
> Greece but that doesn't affect other programs either.
> 
> In general these settings make almost all programs to display English
> by default. Only a minority like git-gui don't.

I suggest you raising this question on the msysgit mailing list [1] or file a bug to its tracker.

1. http://groups.google.com/group/msysgit/
Pat Thoyts· Nov 2, 2010, 15:25 UTC · re: Michael Menegakis · lore

[PATCH] git-gui: detect the use of MUI langauge packs on Windows

The Tcl msgcat package doesn't detect the use of a multi-lingual language pack on Windows 7. This means that a user may have their display language set to Japanese but the system installed langauge was English. This patch reads the relevent registry key to fix this before loading in the locale specific parts of git-gui.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
---
Pat Thoyts <patthoyts@users.sourceforge.net> writes:
Show 27 quoted lines
>Michael Menegakis <arxeio@gmail.com> writes:
>>For some unknown sorcery Microsoft does not refer to 'Locale' the same
>>as UNIX. There is only a display-characters method, only if a
>>character set is not unicode. For actual display of language they have
>>now on 7 a package downloading mechanism to have the whole system show
>>a language.
>>
>>On 7 right now I have locale on Greek so that any non-unicode programs
>>will work with that. But the display language is English and no Greek
>>or other non-English package has been installed. The location is also
>>Greece but that doesn't affect other programs either.
>>
>>In general these settings make almost all programs to display English
>>by default. Only a minority like git-gui don't.
>
>This is a fault in Tcl on Windows when you are making use of language
>packs to switch the display language on Vista or Windows 7. Tcl will
>correctly identify your system language but the newer language pack
>features make use of additional settings. See
>https://sourceforge.net/tracker/?func=detail&aid=3036566&group_id=10894&atid=110894
>for more on the Tcl issue.
>Until this is fixed upstream you can fix this for all Tcl/Tk programs
>(and many others) by ensuring that the LANG environment variable
>matches your display locale. ie: if you install the japanese language
>pack on an English version of Windows 7 and then set the display
>locale to japansese and set the LANG environment variable to LANG=ja
>then git gui would appear in Japanese. For Greek - use LANG=gr

It occurred to me that we do not actually have to wait for the patch mentioned above to be applied to the tcl core. We can patch up the msgcat package during git-gui startup and check the relevant registry location to check for a MUI language pack.

This seems to work OK when I check on a Japanese pack on English Win7.
 git-gui.sh |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/git-gui.sh b/git-gui.sh
index d3acf0d..8cba1aa 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -93,6 +93,27 @@ if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} {
 
 package require msgcat
 
+# Check for Windows 7 MUI language pack (missed by msgcat < 1.4.4)
+if {[tk windowingsystem] eq "win32"
+	&& [package vcompare [package provide msgcat] 1.4.4] < 0
+} then {
+	proc _mc_update_locale {} {
+		puts stderr "check for MUI pack"
+		set key {HKEY_CURRENT_USER\Control Panel\Desktop}
+		if {![catch {
+			package require registry
+			set uilocale [registry get $key "PreferredUILanguages"]
+			msgcat::ConvertLocale [string map {- _} [lindex $uilocale 0]]
+		} uilocale]} {
+			if {[string length $uilocale] > 0} {
+				puts stderr "update locale to $uilocale"
+				msgcat::mclocale $uilocale
+			}
+		}
+	}
+	_mc_update_locale
+}
+
 proc _mc_trim {fmt} {
 	set cmk [string first @@ $fmt]
 	if {$cmk > 0} {
-- 
1.7.3.1.msysgit.0

← back to recent threads