diff options
author | Pat Thoyts <patthoyts@users.sourceforge.net> | 2011-02-18 13:42:54 +0000 |
---|---|---|
committer | Pat Thoyts <patthoyts@users.sourceforge.net> | 2011-03-25 08:26:31 +0000 |
commit | 35b6f72feb998add040d95a9c89ff7ecd4d74901 (patch) | |
tree | e50d8b8d0285c95c6b3c81af0af0357fd4fe5781 | |
parent | 4c2519e5a287709e3306449fc05bcdd2aefe8c7b (diff) | |
download | git-35b6f72feb998add040d95a9c89ff7ecd4d74901.tar.gz git-35b6f72feb998add040d95a9c89ff7ecd4d74901.tar.xz |
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>
-rwxr-xr-x | git-gui.sh | 19 |
1 files changed, 19 insertions, 0 deletions
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} { |