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>
This commit is contained in:
Pat Thoyts 2011-02-18 13:42:54 +00:00
parent 4c2519e5a2
commit 35b6f72feb

View File

@ -93,6 +93,25 @@ 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 {} {
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} {
msgcat::mclocale $uilocale
}
}
}
_mc_update_locale
}
proc _mc_trim {fmt} {
set cmk [string first @@ $fmt]
if {$cmk > 0} {