summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorbagnonm <bagnonm>2002-04-16 11:41:53 (GMT)
committerbagnonm <bagnonm>2002-04-16 11:41:53 (GMT)
commit8304318737dab8f9fff952f3c99469f815253c44 (patch)
tree91ac9a73edf65fc868708fbbf9aad720fddf0406 /library
parentb703acd7760d1327dec7845ecb233f1772469f83 (diff)
downloadtk-8304318737dab8f9fff952f3c99469f815253c44.zip
tk-8304318737dab8f9fff952f3c99469f815253c44.tar.gz
tk-8304318737dab8f9fff952f3c99469f815253c44.tar.bz2
new feature request, 539309 make dependence on msgcat "soft"
msgcat procedures as used in tk defined in case the package is not available.
Diffstat (limited to 'library')
-rw-r--r--library/tk.tcl33
1 files changed, 30 insertions, 3 deletions
diff --git a/library/tk.tcl b/library/tk.tcl
index e7379c1..364d084 100644
--- a/library/tk.tcl
+++ b/library/tk.tcl
@@ -3,7 +3,7 @@
# Initialization script normally executed in the interpreter for each
# Tk-based application. Arranges class bindings for widgets.
#
-# RCS: @(#) $Id: tk.tcl,v 1.35 2002/02/22 14:07:01 dkf Exp $
+# RCS: @(#) $Id: tk.tcl,v 1.36 2002/04/16 11:41:53 bagnonm Exp $
#
# Copyright (c) 1992-1994 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
@@ -17,8 +17,35 @@ package require -exact Tk 8.4
package require -exact Tcl 8.4
if { ![interp issafe] } {
- package require msgcat
- ::msgcat::mcload [file join $::tk_library msgs]
+ if {[catch {package require msgcat}]} {
+ # msgcat not found. A minimal msgcat is defined
+ # here, with fail-safe versions of the msgcat::mc and
+ # msgcat::mcmax procedures, which happen to be the msgcat
+ # services used by tk widgets.
+ # See the msgcat package for details about the simulated
+ # procedures.
+ namespace eval msgcat {
+ namespace export mc mcmax
+
+ proc mc {src args} {
+ return [eval [list format $src $args]]
+ }
+
+ proc mcmax {args} {
+ set max 0
+ foreach string $args {
+ set len [string length [msgcat::mc $string]]
+ if {$len>$max} {
+ set max $len
+ }
+ }
+ return $max
+ }
+
+ }
+ } else {
+ ::msgcat::mcload [file join $::tk_library msgs]
+ }
}
# Add Tk's directory to the end of the auto-load search path, if it