@matheusbsbs / matheus-bagliano / commits / 35b6f72feb
Fork 0

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 committed Feb 18, 2011 at 13:42 UTC 35b6f72feb998add040d95a9c89ff7ecd4d74901
1 file changed +19
git-gui.sh
+19
@@ -93,6 +93,25 @@ if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} {
93
94 package require msgcat
95
96 +# Check for Windows 7 MUI language pack (missed by msgcat < 1.4.4)
97 +if {[tk windowingsystem] eq "win32"
98 + && [package vcompare [package provide msgcat] 1.4.4] < 0
99 +} then {
100 + proc _mc_update_locale {} {
101 + set key {HKEY_CURRENT_USER\Control Panel\Desktop}
102 + if {![catch {
103 + package require registry
104 + set uilocale [registry get $key "PreferredUILanguages"]
105 + msgcat::ConvertLocale [string map {- _} [lindex $uilocale 0]]
106 + } uilocale]} {
107 + if {[string length $uilocale] > 0} {
108 + msgcat::mclocale $uilocale
109 + }
110 + }
111 + }
112 + _mc_update_locale
113 +}
114 +
115 proc _mc_trim {fmt} {
116 set cmk [string first @@ $fmt]
117 if {$cmk > 0} {