Skip to content

Commit ef87a48

Browse files
alexhenriepaulusmack
authored andcommitted
gitk: Remove mc parameter from proc show_error
This is a better fix for 8d84995. 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>
1 parent eb859df commit ef87a48

1 file changed

Lines changed: 23 additions & 23 deletions

File tree

gitk

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,13 +1894,13 @@ proc make_transient {window origin} {
18941894
}
18951895
}
18961896

1897-
proc show_error {w top msg {mc mc}} {
1897+
proc show_error {w top msg} {
18981898
global NS
18991899
if {![info exists NS]} {set NS ""}
19001900
if {[wm state $top] eq "withdrawn"} { wm deiconify $top }
19011901
message $w.m -text $msg -justify center -aspect 400
19021902
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"
19041904
pack $w.ok -side bottom -fill x
19051905
bind $top <Visibility> "grab $top; focus $top"
19061906
bind $top <Key-Return> "destroy $top"
@@ -12016,10 +12016,29 @@ proc get_path_encoding {path} {
1201612016
return $tcl_enc
1201712017
}
1201812018

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+
1201912038
# First check that Tcl/Tk is recent enough
1202012039
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."]
1202312042
exit 1
1202412043
}
1202512044

@@ -12169,25 +12188,6 @@ if {[tk windowingsystem] eq "aqua"} {
1216912188
set ctxbut <Button-3>
1217012189
}
1217112190

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-
1219112191
catch {
1219212192
# follow the XDG base directory specification by default. See
1219312193
# http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

0 commit comments

Comments
 (0)