gitk: Remove mc parameter from proc show_error
This is a better fix for 8d849957d8
.
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>
This commit is contained in:
parent
eb859df85e
commit
ef87a4801a
46
gitk
46
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 <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
|
||||
|
Loading…
Reference in New Issue
Block a user