diff options
author | stanton <stanton> | 1998-12-07 20:56:53 (GMT) |
---|---|---|
committer | stanton <stanton> | 1998-12-07 20:56:53 (GMT) |
commit | 082e3f3ed08ece41e41c7d8344e768918e7ae155 (patch) | |
tree | 9b1c3c73241a1c8d4c870555ec5282babf9ff57e /library/msgcat1.0 | |
parent | 3dcc2202e14e378b8390380674353bbbec870325 (diff) | |
download | tcl-082e3f3ed08ece41e41c7d8344e768918e7ae155.zip tcl-082e3f3ed08ece41e41c7d8344e768918e7ae155.tar.gz tcl-082e3f3ed08ece41e41c7d8344e768918e7ae155.tar.bz2 |
cleaned up docs
* tests/msgcat.test: Added message catalog test suite.
* library/msgcat1.0/msgcat.tcl: minor bug fixes, integrated latest
changes from Mark Harrison.
Diffstat (limited to 'library/msgcat1.0')
-rw-r--r-- | library/msgcat1.0/msgcat.tcl | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/library/msgcat1.0/msgcat.tcl b/library/msgcat1.0/msgcat.tcl index 330002d..61b8327 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.1.2.2 1998/12/04 21:58:08 stanton Exp $ +# RCS: @(#) $Id: msgcat.tcl,v 1.1.2.3 1998/12/07 20:56:53 stanton Exp $ package provide msgcat 1.0 @@ -27,13 +27,6 @@ namespace eval msgcat { # array key is of the form "<locale>,<namespace>,<src>" and the value is # the translated string. array set msgs {} - - # set default locale, try to get from environment - if {[info exists ::env(LANG)]} { - mclocale $::env(LANG) - } else { - mclocale "C" - } } # msgcat::mc -- @@ -114,16 +107,18 @@ proc msgcat::mcpreferences {} { # langdir The directory to search. # # Results: -# None. +# Returns the number of message catalogs that were loaded. proc msgcat::mcload {langdir} { + set x 0 foreach p [::msgcat::mcpreferences] { set langfile [file join $langdir $p.msg] if {[file exists $langfile]} { + incr x uplevel [list source $langfile] } } - return + return $x } # msgcat::mcset -- @@ -137,7 +132,7 @@ proc msgcat::mcload {langdir} { # the source string is used. # # Results: -# None. +# Returns the new locale. proc msgcat::mcset {locale src {dest ""}} { if {$dest == ""} { @@ -147,7 +142,7 @@ proc msgcat::mcset {locale src {dest ""}} { set ns [uplevel {namespace current}] set ::msgcat::msgs($locale,$ns,$src) $dest - return + return $dest } # msgcat::mcunknown -- @@ -168,3 +163,13 @@ proc msgcat::mcunknown {locale src} { return $src } +# Initialize the default locale + +namespace eval msgcat { + # set default locale, try to get from environment + if {[info exists ::env(LANG)]} { + mclocale $::env(LANG) + } else { + mclocale "C" + } +} |