diff options
author | Alex Henrie <alexhenrie24@gmail.com> | 2015-05-11 13:26:41 -0600 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2015-05-17 10:45:55 +1000 |
commit | ef87a4801a8732bd60b4f96ce1f8d66ca2bdf2f1 (patch) | |
tree | feea0c639f2bef20d7432b01d573e51c95e63efa | |
parent | gitk: Fix error when changing colors after closing "List references" window (diff) | |
download | tgif-ef87a4801a8732bd60b4f96ce1f8d66ca2bdf2f1.tar.xz |
gitk: Remove mc parameter from proc show_error
This is a better fix for 8d849957d81fc0480a52570d66cc3c2a688ecb1b.
This new fix makes the strings "Sorry, gitk cannot run..." and "OK"
translatable and the string "mc" not translatable. It will take effect
the next time `make update-po` is run.
msgcat is now imported before the Tcl/Tk version check so that the mc
function is available even if the version check fails. This should not
be a problem because msgcat and ::msgcat::mc were officially added in
Tcl 8.1 (released April 29, 1999) and we are not trying to support
versions of Tcl older than that.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rwxr-xr-x | gitk | 46 |
1 files changed, 23 insertions, 23 deletions
@@ -1894,13 +1894,13 @@ proc make_transient {window origin} { } } -proc show_error {w top msg {mc mc}} { +proc show_error {w top msg} { global NS if {![info exists NS]} {set NS ""} if {[wm state $top] eq "withdrawn"} { wm deiconify $top } message $w.m -text $msg -justify center -aspect 400 pack $w.m -side top -fill x -padx 20 -pady 20 - ${NS}::button $w.ok -default active -text [$mc OK] -command "destroy $top" + ${NS}::button $w.ok -default active -text [mc OK] -command "destroy $top" pack $w.ok -side bottom -fill x bind $top <Visibility> "grab $top; focus $top" bind $top <Key-Return> "destroy $top" @@ -12016,10 +12016,29 @@ proc get_path_encoding {path} { return $tcl_enc } +## For msgcat loading, first locate the installation location. +if { [info exists ::env(GITK_MSGSDIR)] } { + ## Msgsdir was manually set in the environment. + set gitk_msgsdir $::env(GITK_MSGSDIR) +} else { + ## Let's guess the prefix from argv0. + set gitk_prefix [file dirname [file dirname [file normalize $argv0]]] + set gitk_libdir [file join $gitk_prefix share gitk lib] + set gitk_msgsdir [file join $gitk_libdir msgs] + unset gitk_prefix +} + +## Internationalization (i18n) through msgcat and gettext. See +## http://www.gnu.org/software/gettext/manual/html_node/Tcl.html +package require msgcat +namespace import ::msgcat::mc +## And eventually load the actual message catalog +::msgcat::mcload $gitk_msgsdir + # First check that Tcl/Tk is recent enough if {[catch {package require Tk 8.4} err]} { - show_error {} . "Sorry, gitk cannot run with this version of Tcl/Tk.\n\ - Gitk requires at least Tcl/Tk 8.4." list + show_error {} . [mc "Sorry, gitk cannot run with this version of Tcl/Tk.\n\ + Gitk requires at least Tcl/Tk 8.4."] exit 1 } @@ -12169,25 +12188,6 @@ if {[tk windowingsystem] eq "aqua"} { set ctxbut <Button-3> } -## For msgcat loading, first locate the installation location. -if { [info exists ::env(GITK_MSGSDIR)] } { - ## Msgsdir was manually set in the environment. - set gitk_msgsdir $::env(GITK_MSGSDIR) -} else { - ## Let's guess the prefix from argv0. - set gitk_prefix [file dirname [file dirname [file normalize $argv0]]] - set gitk_libdir [file join $gitk_prefix share gitk lib] - set gitk_msgsdir [file join $gitk_libdir msgs] - unset gitk_prefix -} - -## Internationalization (i18n) through msgcat and gettext. See -## http://www.gnu.org/software/gettext/manual/html_node/Tcl.html -package require msgcat -namespace import ::msgcat::mc -## And eventually load the actual message catalog -::msgcat::mcload $gitk_msgsdir - catch { # follow the XDG base directory specification by default. See # http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html |