diff options
author | ericm <ericm> | 2000-07-06 21:05:01 (GMT) |
---|---|---|
committer | ericm <ericm> | 2000-07-06 21:05:01 (GMT) |
commit | 003f25f16aa9d093b468f4c74a1eece63c929c88 (patch) | |
tree | f41e6aac70ba45c195c73c507ba94d6f19bf127e /library | |
parent | be8ba4515aaf9da7893bcb0930ca1965e0602cb3 (diff) | |
download | tcl-003f25f16aa9d093b468f4c74a1eece63c929c88.zip tcl-003f25f16aa9d093b468f4c74a1eece63c929c88.tar.gz tcl-003f25f16aa9d093b468f4c74a1eece63c929c88.tar.bz2 |
* tests/msgcat.test:
* library/msgcat1.0/msgcat.tcl: Applied patch from Christian
Krone, to provide extended args support for msgcat::unknown, which
is used for strings without a known translation in the current
locale [Bug: 5984].
Diffstat (limited to 'library')
-rw-r--r-- | library/msgcat/msgcat.tcl | 15 | ||||
-rw-r--r-- | library/msgcat1.0/msgcat.tcl | 15 |
2 files changed, 22 insertions, 8 deletions
diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index 0f7d6d3..fb1aeb3 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -10,7 +10,7 @@ # 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.5 2000/06/30 06:28:27 ericm Exp $ +# RCS: @(#) $Id: msgcat.tcl,v 1.6 2000/07/06 21:05:02 ericm Exp $ package provide msgcat 1.1 @@ -67,7 +67,7 @@ proc msgcat::mc {src args} { } # we have not found the translation return [uplevel 1 [list [namespace origin mcunknown] \ - $::msgcat::locale $src]] + $::msgcat::locale $src] $args] } # msgcat::mclocale -- @@ -170,16 +170,23 @@ proc msgcat::mcset {locale src {dest ""}} { # be found for a string. This routine is intended to be replaced # by an application specific routine for error reporting # purposes. The default behavior is to return the source string. +# If additional args are specified, the format command will be used +# to work them into the traslated string. # # Arguments: # locale The current locale. # src The string to be translated. +# args Args to pass to the format command # # Results: # Returns the translated value. -proc msgcat::mcunknown {locale src} { - return $src +proc msgcat::mcunknown {locale src args} { + if {[llength $args]} { + return [eval [list format $src] $args] + } else { + return $src + } } # msgcat::mcmax -- diff --git a/library/msgcat1.0/msgcat.tcl b/library/msgcat1.0/msgcat.tcl index 0f7d6d3..fb1aeb3 100644 --- a/library/msgcat1.0/msgcat.tcl +++ b/library/msgcat1.0/msgcat.tcl @@ -10,7 +10,7 @@ # 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.5 2000/06/30 06:28:27 ericm Exp $ +# RCS: @(#) $Id: msgcat.tcl,v 1.6 2000/07/06 21:05:02 ericm Exp $ package provide msgcat 1.1 @@ -67,7 +67,7 @@ proc msgcat::mc {src args} { } # we have not found the translation return [uplevel 1 [list [namespace origin mcunknown] \ - $::msgcat::locale $src]] + $::msgcat::locale $src] $args] } # msgcat::mclocale -- @@ -170,16 +170,23 @@ proc msgcat::mcset {locale src {dest ""}} { # be found for a string. This routine is intended to be replaced # by an application specific routine for error reporting # purposes. The default behavior is to return the source string. +# If additional args are specified, the format command will be used +# to work them into the traslated string. # # Arguments: # locale The current locale. # src The string to be translated. +# args Args to pass to the format command # # Results: # Returns the translated value. -proc msgcat::mcunknown {locale src} { - return $src +proc msgcat::mcunknown {locale src args} { + if {[llength $args]} { + return [eval [list format $src] $args] + } else { + return $src + } } # msgcat::mcmax -- |