diff options
Diffstat (limited to 'library/msgcat/msgcat.tcl')
-rw-r--r-- | library/msgcat/msgcat.tcl | 30 |
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 { |