From 35b6f72feb998add040d95a9c89ff7ecd4d74901 Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Fri, 18 Feb 2011 13:42:54 +0000 Subject: 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 --- git-gui.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/git-gui.sh b/git-gui.sh index d96df63ab..fd6a43d0a 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -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} { -- cgit v1.2.1