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>

Alex Henrie committed May 11, 2015 at 13:26 UTC ef87a4801a8732bd60b4f96ce1f8d66ca2bdf2f1
1 file changed +23 -23
gitk
+23 -23
@@ -1894,13 +1894,13 @@ proc make_transient {window origin} {
1894 }
1895 }
1896
1897 -proc show_error {w top msg {mc mc}} {
1897 +proc show_error {w top msg} {
1898 global NS
1899 if {![info exists NS]} {set NS ""}
1900 if {[wm state $top] eq "withdrawn"} { wm deiconify $top }
1901 message $w.m -text $msg -justify center -aspect 400
1902 pack $w.m -side top -fill x -padx 20 -pady 20
1903 - ${NS}::button $w.ok -default active -text [$mc OK] -command "destroy $top"
1903 + ${NS}::button $w.ok -default active -text [mc OK] -command "destroy $top"
1904 pack $w.ok -side bottom -fill x
1905 bind $top <Visibility> "grab $top; focus $top"
1906 bind $top <Key-Return> "destroy $top"
@@ -12016,10 +12016,29 @@ proc get_path_encoding {path} {
12016 return $tcl_enc
12017 }
12018
12019 +## For msgcat loading, first locate the installation location.
12020 +if { [info exists ::env(GITK_MSGSDIR)] } {
12021 + ## Msgsdir was manually set in the environment.
12022 + set gitk_msgsdir $::env(GITK_MSGSDIR)
12023 +} else {
12024 + ## Let's guess the prefix from argv0.
12025 + set gitk_prefix [file dirname [file dirname [file normalize $argv0]]]
12026 + set gitk_libdir [file join $gitk_prefix share gitk lib]
12027 + set gitk_msgsdir [file join $gitk_libdir msgs]
12028 + unset gitk_prefix
12029 +}
12030 +
12031 +## Internationalization (i18n) through msgcat and gettext. See
12032 +## http://www.gnu.org/software/gettext/manual/html_node/Tcl.html
12033 +package require msgcat
12034 +namespace import ::msgcat::mc
12035 +## And eventually load the actual message catalog
12036 +::msgcat::mcload $gitk_msgsdir
12037 +
12038 # First check that Tcl/Tk is recent enough
12039 if {[catch {package require Tk 8.4} err]} {
12021 - show_error {} . "Sorry, gitk cannot run with this version of Tcl/Tk.\n\
12022 - Gitk requires at least Tcl/Tk 8.4." list
12040 + show_error {} . [mc "Sorry, gitk cannot run with this version of Tcl/Tk.\n\
12041 + Gitk requires at least Tcl/Tk 8.4."]
12042 exit 1
12043 }
12044
@@ -12169,25 +12188,6 @@ if {[tk windowingsystem] eq "aqua"} {
12188 set ctxbut <Button-3>
12189 }
12190
12172 -## For msgcat loading, first locate the installation location.
12173 -if { [info exists ::env(GITK_MSGSDIR)] } {
12174 - ## Msgsdir was manually set in the environment.
12175 - set gitk_msgsdir $::env(GITK_MSGSDIR)
12176 -} else {
12177 - ## Let's guess the prefix from argv0.
12178 - set gitk_prefix [file dirname [file dirname [file normalize $argv0]]]
12179 - set gitk_libdir [file join $gitk_prefix share gitk lib]
12180 - set gitk_msgsdir [file join $gitk_libdir msgs]
12181 - unset gitk_prefix
12182 -}
12183 -
12184 -## Internationalization (i18n) through msgcat and gettext. See
12185 -## http://www.gnu.org/software/gettext/manual/html_node/Tcl.html
12186 -package require msgcat
12187 -namespace import ::msgcat::mc
12188 -## And eventually load the actual message catalog
12189 -::msgcat::mcload $gitk_msgsdir
12190 -
12191 catch {
12192 # follow the XDG base directory specification by default. See
12193 # http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html