From ef87a4801a8732bd60b4f96ce1f8d66ca2bdf2f1 Mon Sep 17 00:00:00 2001 From: Alex Henrie Date: Mon, 11 May 2015 13:26:41 -0600 Subject: [PATCH] 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 Signed-off-by: Paul Mackerras --- gitk | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/gitk b/gitk index c18670488d..78baeb57cd 100755 --- a/gitk +++ b/gitk @@ -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 "grab $top; focus $top" bind $top "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 } -## 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 -- 2.47.1