summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
Diffstat (limited to 'library')
-rw-r--r--library/msgcat/msgcat.tcl30
-rw-r--r--library/msgcat1.0/msgcat.tcl30
2 files changed, 52 insertions, 8 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 {
diff --git a/library/msgcat1.0/msgcat.tcl b/library/msgcat1.0/msgcat.tcl
index 4619ae1..0f7d6d3 100644
--- a/library/msgcat1.0/msgcat.tcl
+++ b/library/msgcat1.0/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 {