summaryrefslogtreecommitdiffstats
path: root/library/msgcat/msgcat.tcl
diff options
context:
space:
mode:
authorericm <ericm>2000-06-30 06:28:26 (GMT)
committerericm <ericm>2000-06-30 06:28:26 (GMT)
commitbe8ba4515aaf9da7893bcb0930ca1965e0602cb3 (patch)
tree08cdf6c63cdabcea3bef54c3fcd784745766fb05 /library/msgcat/msgcat.tcl
parent5513f66815de5f44c874f0b1f50a3733d993121d (diff)
downloadtcl-be8ba4515aaf9da7893bcb0930ca1965e0602cb3.zip
tcl-be8ba4515aaf9da7893bcb0930ca1965e0602cb3.tar.gz
tcl-be8ba4515aaf9da7893bcb0930ca1965e0602cb3.tar.bz2
* doc/msgcat.n: Doc's for mcmax function.
* library/msgcat1.0/msgcat.tcl: Applied patches from Laurent Duperval, to add mcmax function, which computes the length of the longest of several translated strings. Bumped version number to 1.1.
Diffstat (limited to 'library/msgcat/msgcat.tcl')
-rw-r--r--library/msgcat/msgcat.tcl30
1 files changed, 26 insertions, 4 deletions
diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl
index 4619ae1..0f7d6d3 100644
--- a/library/msgcat/msgcat.tcl
+++ b/library/msgcat/msgcat.tcl
@@ -4,18 +4,18 @@
# message catalog facility for Tcl programs. It should be
# loaded with the command "package require msgcat".
#
-# Copyright (c) 1998 by Scriptics Corporation.
+# Copyright (c) 1998-2000 by Ajuba Solutions.
# Copyright (c) 1998 by Mark Harrison.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: msgcat.tcl,v 1.4 2000/04/11 21:16:18 ericm Exp $
+# RCS: @(#) $Id: msgcat.tcl,v 1.5 2000/06/30 06:28:27 ericm Exp $
-package provide msgcat 1.0
+package provide msgcat 1.1
namespace eval msgcat {
- namespace export mc mcset mclocale mcpreferences mcunknown
+ namespace export mc mcset mclocale mcpreferences mcunknown mcmax
# Records the current locale as passed to mclocale
variable locale ""
@@ -182,6 +182,28 @@ proc msgcat::mcunknown {locale src} {
return $src
}
+# msgcat::mcmax --
+#
+# Calculates the maximun length of the translated strings of the given
+# list.
+#
+# Arguments:
+# args strings to translate.
+#
+# Results:
+# Returns the length of the longest translated string.
+
+proc msgcat::mcmax {args} {
+ set max 0
+ foreach string $args {
+ set len [string length [msgcat::mc $string]]
+ if {$len>$max} {
+ set max $len
+ }
+ }
+ return $max
+}
+
# Initialize the default locale
namespace eval msgcat {