git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Skip translation of wrong Tcl version text

From
BHBernt Hansen <bernt@norang.ca>
Date
Nov 2, 2009, 12:41 UTC
Message-ID
<87ljipje03.fsf@gollum.intra.norang.ca>
In-Reply-To
<874opel7de.fsf@gollum.intra.norang.ca>

We check the required Tcl version number before we setup msgcat for language translation. If the Tcl version is too old just display the untranslated error text.

The caller of show_error can now pass an alternative function for mc. The Tcl list function turns the transalation into a no-op.

This fixes the
    Error in startup script: invalid command name "mc"
when attempting to start gitk with Tcl 8.3.
Signed-off-by: Bernt Hansen <bernt@norang.ca>
---
I tested this patch with both Tcl 8.3 and 8.4.

This is an alternative to the previous 2 patches I sent attempting to initialize msgcat before first use. This patch is much simpler but does not attempt to translate the wrong version message text.

This patch fixes the version number error message by displaying it untranslated since msgcat is not initialized yet. The current initialization code for msgcat uses normalize which is only available as of Tcl 8.4 so moving the code up front didn't work in Tcl 8.3.

 gitk |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gitk b/gitk
index a0214b7..d1f32a9 100755
--- a/gitk
+++ b/gitk
@@ -1787,10 +1787,10 @@ proc make_transient {window origin} {
     }
 }
 
-proc show_error {w top msg} {
+proc show_error {w top msg {mc mc}} {
     message $w.m -text $msg -justify center -aspect 400
     pack $w.m -side top -fill x -padx 20 -pady 20
-    button $w.ok -text [mc OK] -command "destroy $top"
+    button $w.ok -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"
@@ -11006,8 +11006,8 @@ proc get_path_encoding {path} {
 
 # First check that Tcl/Tk is recent enough
 if {[catch {package require Tk 8.4} err]} {
-    show_error {} . [mc "Sorry, gitk cannot run with this version of Tcl/Tk.\n\
-		     Gitk requires at least Tcl/Tk 8.4."]
+    show_error {} . "Sorry, gitk cannot run with this version of Tcl/Tk.\n\
+		     Gitk requires at least Tcl/Tk 8.4." list
     exit 1
 }
 
-- 
1.6.5.2.141.gc8a58
Previous: Bernt HansenNext: Paul Mackerras
Message 5 of 8 in “gitk: Fix error display when Tcl is too old”
  1. 0/2 gitk: Fix error display when Tcl is too oldBernt Hansen, Oct 24, 2009
  2. 1/2 gitk: Initialize msgcat before first useBernt Hansen, Oct 24, 2009
  3. Pat ThoytsOct 31, 2009
  4. Bernt HansenNov 1, 2009
  5. Skip translation of wrong Tcl version textBernt Hansen, Nov 2, 2009
  6. Paul MackerrasNov 3, 2009
  7. 2/2 gitk: Provide a default mc function if msgcat is not availableBernt Hansen, Oct 24, 2009
  8. Junio C HamanoOct 24, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.