Tcl Source Code

Artifact [4dc039b9de]
Login

Artifact 4dc039b9de0ceeb8fb4df781ca8bb11631520de7:

Attachment "msgcat.diff" to ticket [3511941fff] added by oehhar 2012-03-27 22:02:44.
16c16
< package provide msgcat 1.4.4
---
> package provide msgcat 1.5.0
19,20c19,20
<     namespace export mc mcload mclocale mcmax mcmset mcpreferences mcset \
< 	    mcunknown
---
>     namespace export mcconfig mc mcload mclocale mcmax mcmset mcpreferences \
> 	    mcset mcunknown
27a28,30
>     # List of file pattern to load in addition to Loclist.
>     variable Patternlist {}
> 
164a168,199
> # msgcat::mcconfig option ?value? ?option? ?value?
> #
> #	Get or set a package option.
> #	To set options, one may specify multiple option-value pairs.
> #	To read an option value, one may specify a single option.
> #	Available options are:
> #	-pattern
> #	    List of file pattern to load in addition to mcpreferences
> #
> # Arguments:
> #	option	The name of the option
> #	value	The new value of the option
> #
> # Results:
> #	The value if options are read
> 
> proc msgcat::mcconfig {args} {
>     variable Patternlist
>     if {1 == [llength $args]} {
> 	switch -exact -- [lindex $args] {
> 	    -pattern { return $Patternlist}
> 	    default { return -code error "Unknown option" }
> 	}
>     }
>     dict for {option value} $args {
> 	switch -exact -- $option {
> 	    -pattern { set Patternlist $value }
> 	    default { return -code error "Unknown option" }
> 	}
>     }
> }
> 
278a314
>     variable Patternlist
280,287c316,319
<     foreach p [mcpreferences] {
< 	if { $p eq {} } {
< 	    set p ROOT
< 	}
< 	set langfile [file join $langdir $p.msg]
< 	if {[file exists $langfile]} {
< 	    incr x
< 	    uplevel 1 [list ::source -encoding utf-8 $langfile]
---
>     set filelist {}
>     foreach pattern [lsort -unique [concat [mcpreferences] $Patternlist]] {
> 	if { $pattern eq {} } {
> 	    set pattern ROOT
288a321,326
> 	lappend filelist {*}[glob -directory $langdir -nocomplain -types {f r}\
> 		-- $pattern.msg]
>     }
>     foreach langfile [lsort -unique $filelist] {
> 	incr x
> 	uplevel 1 [list ::source -encoding utf-8 $langfile]