Tcl Source Code

Check-in [67aa09246b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[msgcat] revert changes of "msgcat" to previous state before clock-speedup, move this functionality to "clock.tcl"; additionally avoids the usage of catch (uses pair "dict exists/dict get" instead of).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sebres-8-6-clock-speedup-cr1
Files: files | file ages | folders
SHA1: 67aa09246b81305332ceeeb393f62d307d797df9
User & Date: sebres 2017-05-30 16:41:48
Context
2017-05-31
08:31
Remove "timerate" functionality: this definitely needs a TIP. Also undo changes in library/reg/pkgIn... check-in: 848d01b6ef user: jan.nijtmans tags: sebres-8-6-clock-speedup-cr1
2017-05-30
16:41
[msgcat] revert changes of "msgcat" to previous state before clock-speedup, move this functionality ... check-in: 67aa09246b user: sebres tags: sebres-8-6-clock-speedup-cr1
08:46
small code review: resolves several warning on some compilers check-in: 7303c86999 user: sebres tags: sebres-8-6-clock-speedup-cr1
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to library/clock.tcl.

502
503
504
505
506
507
508



509
510
511
512
513














514

515
516
517
518
519



















































520
















521
522
523
524
525
526
527
					# and whose values are lists of quads
					# comprising start time, UTC offset,
					# Daylight Saving Time indicator, and
					# time zone abbreviation.
    variable FormatProc;		# Array mapping format group
					# and locale to the name of a procedure
					# that renders the given format



}
::tcl::clock::Initialize

#----------------------------------------------------------------------















proc mcget {locale args} {

    switch -- $locale system {
    	set locale [GetSystemLocale]
    } current {
	set locale [mclocale]
    }



















































    msgcat::mcget ::tcl::clock $locale {*}$args
















}

#----------------------------------------------------------------------
#
# GetSystemLocale --
#
#	Determines the system locale, which corresponds to "system"







>
>
>





>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
|
|

|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
					# and whose values are lists of quads
					# comprising start time, UTC offset,
					# Daylight Saving Time indicator, and
					# time zone abbreviation.
    variable FormatProc;		# Array mapping format group
					# and locale to the name of a procedure
					# that renders the given format

    variable mcLocales	 [dict create];	# Dictionary with loaded locales
    variable mcMergedCat [dict create];	# Dictionary with merged locale catalogs
}
::tcl::clock::Initialize

#----------------------------------------------------------------------

# mcget --
#
#	Return the merged translation catalog for the ::tcl::clock namespace
#	Searching of catalog is similar to "msgcat::mc".
#
#	Contrary to "msgcat::mc" may additionally load a package catalog 
#	on demand.
#
# Arguments:
#	loc	The locale used for translation.
#
# Results:
#	Returns the dictionary object as whole catalog of the package/locale.
#
proc mcget {loc} {
    variable mcMergedCat
    switch -- $loc system {
	set loc [GetSystemLocale]
    } current {
	set loc [mclocale]
    }
    if {$loc eq {C}} {
	set loclist [msgcat::PackagePreferences ::tcl::clock]
	set loc [lindex $loclist 0]
    } else {
    	set loc [string tolower $loc]
    }

    # try to retrieve now if already available:
    if {[dict exists $mcMergedCat $loc]} {
	set mrgcat [dict get $mcMergedCat $loc]
	return [dict smartref $mrgcat]
    }

    # get locales list for given locale (de_de -> {de_de de {}})
    variable mcLocales
    if {[dict exists $mcLocales $loc]} {
	set loclist [dict get $mcLocales $loc]
    } else {
	# save current locale:
	set prevloc [mclocale]
	# lazy load catalog on demand (set it will load the catalog)
	mcpackagelocale set $loc
	set loclist [msgcat::GetPreferences $loc]
	dict set $mcLocales $loc $loclist
	# restore:
        if {$prevloc ne $loc} {
	   mcpackagelocale set $prevloc
	}
    }
    # get whole catalog:
    mcMerge $loclist
}

# mcMerge --
#
#	Merge message catalog dictionaries to one dictionary.
#
# Arguments:
#	locales		List of locales to merge.
#
# Results:
#	Returns the (weak pointer) to merged dictionary of message catalog.
#
proc mcMerge {locales} {
    variable mcMergedCat
    if {[dict exists $mcMergedCat [set loc [lindex $locales 0]]]} {
	set mrgcat [dict get $mcMergedCat $loc]
	return [dict smartref $mrgcat]
    }
    # package msgcat currently does not provide possibility to get whole catalog:
    upvar ::msgcat::Msgs Msgs
    set ns ::tcl::clock
    # Merge sequential locales (in reverse order, e. g. {} -> en -> en_en):
    if {[llength $locales] > 1} {
	set mrgcat [mcMerge [lrange $locales 1 end]]
	if {[dict exists $Msgs $ns $loc]} {
	    set mrgcat [dict merge $mrgcat [dict get $Msgs $ns $loc]]
	}
    } else {
	if {[dict exists $Msgs $ns $loc]} {
	    set mrgcat [dict get $Msgs $ns $loc]
	} else {
	    set mrgcat [dict create]
	}
    }
    dict set mcMergedCat $loc $mrgcat
    # return smart reference (shared dict as object with exact one ref-counter)
    return [dict smartref $mrgcat]
}

#----------------------------------------------------------------------
#
# GetSystemLocale --
#
#	Determines the system locale, which corresponds to "system"
2000
2001
2002
2003
2004
2005
2006

2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
#
#----------------------------------------------------------------------

proc ::tcl::clock::ClearCaches {} {
    variable FormatProc
    variable LocaleFormats
    variable LocaleNumeralCache

    variable TimeZoneBad

    # tell backend - should invalidate:
    configure -clear

    # clear msgcat cache:
    msgcat::ClearCaches ::tcl::clock

    foreach p [info procs [namespace current]::scanproc'*] {
	rename $p {}
    }
    foreach p [info procs [namespace current]::formatproc'*] {
	rename $p {}
    }







>






|







2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
#
#----------------------------------------------------------------------

proc ::tcl::clock::ClearCaches {} {
    variable FormatProc
    variable LocaleFormats
    variable LocaleNumeralCache
    variable mcMergedCat
    variable TimeZoneBad

    # tell backend - should invalidate:
    configure -clear

    # clear msgcat cache:
    set mcMergedCat [dict create]

    foreach p [info procs [namespace current]::scanproc'*] {
	rename $p {}
    }
    foreach p [info procs [namespace current]::formatproc'*] {
	rename $p {}
    }

Changes to library/msgcat/msgcat.tcl.

221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
    switch -exact -- [Invoke unknowncmd $args $ns result 1] {
	0 { return [uplevel 1 [linsert $args 0 [namespace origin mcunknown]]] }
	1 { return [DefaultUnknown {*}$args] }
	default { return $result }
    }
}

# msgcat::mcget --
#
#	Return the translation for the given string based on the given
#	locale setting or the whole dictionary object of the package/locale.
#	Searching of catalog is similar to "msgcat::mc".
#
#	Contrary to "msgcat::mc" may additionally load a package catalog 
#	on demand.
#
# Arguments:
#	ns	The package namespace (as catalog selector).
#	loc	The locale used for translation.
#	{src}	The string to translate.
#	{args}	Args to pass to the format command
#
# Results:
#	Returns the translated string.  Propagates errors thrown by the
#	format command.

proc msgcat::mcget {ns loc args} {
    if {$loc eq {C}} {
	set loclist [PackagePreferences $ns]
	set loc [lindex $loclist 0]
    } else {
    	set loc [string tolower $loc]
	variable PackageConfig
	# get locales list for given locale (de_de -> {de_de de {}})
	if {[catch {
	    set loclist [dict get $PackageConfig locales $ns $loc]
	}]} {
	    # lazy load catalog on demand
	    mcpackagelocale load $loc $ns
	    set loclist [dict get $PackageConfig locales $ns $loc]
	}
    }
    if {![llength $args]} {
	# get whole catalog:
	return [msgcat::Merge $ns $loclist]
    }
    set src [lindex $args 0]
    # search translation for each locale (regarding parent namespaces)
    for {set nscur $ns} {$nscur != ""} {set nscur [namespace parent $nscur]} {
	foreach loc $loclist {
	    set msgs [mcget $nscur $loc]
	    if {![catch { set val [dict get $msgs $src] }]} {
		if {[llength $args] == 1} {
		    return $val
		}
		return [format $val {*}[lrange $args 1 end]]
	    }
	}
    }
    # no translation :
    if {[llength $args] == 1} {
	return $src
    }
    return [format $src {*}[lrange $args 1 end]]
}

# msgcat::mcexists --
#
#	Check if a catalog item is set or if mc would invoke mcunknown.
#
# Arguments:
#	-exactnamespace		Only check the exact namespace and no
#				parent namespaces







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







221
222
223
224
225
226
227



























































228
229
230
231
232
233
234
    switch -exact -- [Invoke unknowncmd $args $ns result 1] {
	0 { return [uplevel 1 [linsert $args 0 [namespace origin mcunknown]]] }
	1 { return [DefaultUnknown {*}$args] }
	default { return $result }
    }
}




























































# msgcat::mcexists --
#
#	Check if a catalog item is set or if mc would invoke mcunknown.
#
# Arguments:
#	-exactnamespace		Only check the exact namespace and no
#				parent namespaces
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
#	The following subcommands are available:
#	set
#	    Set a package locale.
#	    This may load message catalog files and may clear message catalog
#	    items, if the former locale was the default locale.
#	    Returns the normalized set locale.
#	    The default locale is taken, if locale is not given.
#	load
#	    Load a package locale without set it (lazy loading from mcget).
#	    Returns the normalized set locale.
#	    The default locale is taken, if locale is not given.
#	get
#	    Get the locale valid for this package.
#	isset
#	    Returns true, if a package locale is set
#	unset
#	    Unset the package locale and activate the default locale.
#	    This loads message catalog file which where missing in the package







<
<
<
<







411
412
413
414
415
416
417




418
419
420
421
422
423
424
#	The following subcommands are available:
#	set
#	    Set a package locale.
#	    This may load message catalog files and may clear message catalog
#	    items, if the former locale was the default locale.
#	    Returns the normalized set locale.
#	    The default locale is taken, if locale is not given.




#	get
#	    Get the locale valid for this package.
#	isset
#	    Returns true, if a package locale is set
#	unset
#	    Unset the package locale and activate the default locale.
#	    This loads message catalog file which where missing in the package
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# Arguments:
#	subcommand		see list above
#	locale			package locale (only set subcommand)
#
# Results:
#	Empty string, if not stated differently for the subcommand

proc msgcat::mcpackagelocale {subcommand {locale ""} {ns ""}} {
    # todo: implement using an ensemble
    variable Loclist
    variable LoadedLocales
    variable Msgs
    variable PackageConfig
    # Check option
    # check if required item is exactly provided
    if {[llength [info level 0]] == 2} {
	# locale not given
	unset locale
    } else {
	# locale given
	if {$subcommand in
		{"get" "isset" "unset" "preferences" "loaded" "clear"} } {
	    return -code error "wrong # args: should be\
		    \"[lrange [info level 0] 0 1]\""
	}
        set locale [string tolower $locale]
    }
    if {$ns eq ""} {
	set ns [uplevel 1 {::namespace current}]
    }

    switch -exact -- $subcommand {
	get { return [lindex [PackagePreferences $ns] 0] }
	preferences { return [PackagePreferences $ns] }
	loaded { return [PackageLocales $ns] }
	present { return [expr {$locale in [PackageLocales $ns]} ]}
	isset { return [dict exists $PackageConfig loclist $ns] }
	set - load { # set a package locale or add a package locale

	    # Copy the default locale if no package locale set so far
	    if {![dict exists $PackageConfig loclist $ns]} {
		dict set PackageConfig loclist $ns $Loclist
		dict set PackageConfig loadedlocales $ns $LoadedLocales
	    }

	    # Check if changed
	    set loclist [dict get $PackageConfig loclist $ns]
	    if {[llength [info level 0]] == 2 || $locale eq [lindex $loclist 0] } {
		return [lindex $loclist 0]
	    }

	    # Change loclist
	    set loclist [GetPreferences $locale]
	    set locale [lindex $loclist 0]
	    if {$subcommand eq {set}} {
		# set loclist
		dict set PackageConfig loclist $ns $loclist
	    }

	    # load eventual missing locales
	    set loadedLocales [dict get $PackageConfig loadedlocales $ns]
	    dict set PackageConfig locales $ns $locale $loclist
	    if {$locale in $loadedLocales} { return $locale }
	    set loadLocales [ListComplement $loadedLocales $loclist]
	    dict set PackageConfig loadedlocales $ns\
		    [concat $loadedLocales $loadLocales]
	    Load $ns $loadLocales
	    return $locale
	}







|



















<
|
<







|









|






<
<
|
<



<







438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464

465

466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489


490

491
492
493

494
495
496
497
498
499
500
# Arguments:
#	subcommand		see list above
#	locale			package locale (only set subcommand)
#
# Results:
#	Empty string, if not stated differently for the subcommand

proc msgcat::mcpackagelocale {subcommand {locale ""}} {
    # todo: implement using an ensemble
    variable Loclist
    variable LoadedLocales
    variable Msgs
    variable PackageConfig
    # Check option
    # check if required item is exactly provided
    if {[llength [info level 0]] == 2} {
	# locale not given
	unset locale
    } else {
	# locale given
	if {$subcommand in
		{"get" "isset" "unset" "preferences" "loaded" "clear"} } {
	    return -code error "wrong # args: should be\
		    \"[lrange [info level 0] 0 1]\""
	}
        set locale [string tolower $locale]
    }

    set ns [uplevel 1 {::namespace current}]


    switch -exact -- $subcommand {
	get { return [lindex [PackagePreferences $ns] 0] }
	preferences { return [PackagePreferences $ns] }
	loaded { return [PackageLocales $ns] }
	present { return [expr {$locale in [PackageLocales $ns]} ]}
	isset { return [dict exists $PackageConfig loclist $ns] }
	set { # set a package locale or add a package locale

	    # Copy the default locale if no package locale set so far
	    if {![dict exists $PackageConfig loclist $ns]} {
		dict set PackageConfig loclist $ns $Loclist
		dict set PackageConfig loadedlocales $ns $LoadedLocales
	    }

	    # Check if changed
	    set loclist [dict get $PackageConfig loclist $ns]
	    if {! [info exists locale] || $locale eq [lindex $loclist 0] } {
		return [lindex $loclist 0]
	    }

	    # Change loclist
	    set loclist [GetPreferences $locale]
	    set locale [lindex $loclist 0]


	    dict set PackageConfig loclist $ns $loclist


	    # load eventual missing locales
	    set loadedLocales [dict get $PackageConfig loadedlocales $ns]

	    if {$locale in $loadedLocales} { return $locale }
	    set loadLocales [ListComplement $loadedLocales $loclist]
	    dict set PackageConfig loadedlocales $ns\
		    [concat $loadedLocales $loadLocales]
	    Load $ns $loadLocales
	    return $locale
	}
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
	    if { ![dict exists $PackageConfig loclist $ns] } { return }

	    # unset package locale
	    set loadLocales [ListComplement\
		    [dict get $PackageConfig loadedlocales $ns] $LoadedLocales]
	    dict unset PackageConfig loadedlocales $ns
	    dict unset PackageConfig loclist $ns
	    dict unset PackageConfig locales $ns

	    # unset keys not in global loaded locales
	    if {[dict exists $Msgs $ns]} {
		foreach locale [dict keys [dict get $Msgs $ns]] {
		    if {$locale ni $LoadedLocales} {
			dict unset Msgs $ns $locale
		    }







<







517
518
519
520
521
522
523

524
525
526
527
528
529
530
	    if { ![dict exists $PackageConfig loclist $ns] } { return }

	    # unset package locale
	    set loadLocales [ListComplement\
		    [dict get $PackageConfig loadedlocales $ns] $LoadedLocales]
	    dict unset PackageConfig loadedlocales $ns
	    dict unset PackageConfig loclist $ns


	    # unset keys not in global loaded locales
	    if {[dict exists $Msgs $ns]} {
		foreach locale [dict keys [dict get $Msgs $ns]] {
		    if {$locale ni $LoadedLocales} {
			dict unset Msgs $ns $locale
		    }
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
    }
    if {[info exists nestedFileLocale]} {
	set FileLocale $nestedFileLocale
    }
    return $x
}

# msgcat::Merge --
#
#	Merge message catalog dictionaries to one dictionary.
#
# Arguments:
#	ns		Namespace (equal package) to load the message catalog.
#	locales		List of locales to merge.
#
# Results:
#	Returns the merged dictionary of message catalogs.
proc msgcat::Merge {ns locales} {
    variable Merged
    if {![catch {
    	set mrgcat [dict get $Merged $ns [set loc [lindex $locales 0]]]
    }]} {
    	return $mrgcat
    }
    variable Msgs
    # Merge sequential locales (in reverse order, e. g. {} -> en -> en_en):
    if {[llength $locales] > 1} {
	set mrgcat [msgcat::Merge $ns [lrange $locales 1 end]]
	catch {
	    set mrgcat [dict merge $mrgcat [dict get $Msgs $ns $loc]]
	}
    } else {
	if {[catch {
	    set mrgcat [dict get $Msgs $ns $loc]
	}]} {
	    set mrgcat [dict create]
	}
    }
    dict set Merged $ns $loc $mrgcat
    # return smart reference (shared dict as object with exact one ref-counter)
    return [dict smartref $mrgcat]
}

proc msgcat::ClearCaches {ns} {
    variable Merged
    dict unset Merged $ns
}

# msgcat::Invoke --
#
#	Invoke a set of registered callbacks.
#	The callback is only invoked, if its registered namespace exists.
#
# Arguments:
#	index		Index into PackageConfig to get callback command







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







843
844
845
846
847
848
849









































850
851
852
853
854
855
856
    }
    if {[info exists nestedFileLocale]} {
	set FileLocale $nestedFileLocale
    }
    return $x
}










































# msgcat::Invoke --
#
#	Invoke a set of registered callbacks.
#	The callback is only invoked, if its registered namespace exists.
#
# Arguments:
#	index		Index into PackageConfig to get callback command
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
#			the source string is used.
#
# Results:
#	Returns the new locale.

proc msgcat::mcset {locale src {dest ""}} {
    variable Msgs
    variable Merged
    if {[llength [info level 0]] == 3} { ;# dest not specified
	set dest $src
    }

    set ns [uplevel 1 [list ::namespace current]]

    set locale [string tolower $locale]

    dict set Msgs $ns $locale $src $dest
    dict unset Merged $ns
    return $dest
}

# msgcat::mcflset --
#
#	Set the translation for a given string in the current file locale.
#







<









<







915
916
917
918
919
920
921

922
923
924
925
926
927
928
929
930

931
932
933
934
935
936
937
#			the source string is used.
#
# Results:
#	Returns the new locale.

proc msgcat::mcset {locale src {dest ""}} {
    variable Msgs

    if {[llength [info level 0]] == 3} { ;# dest not specified
	set dest $src
    }

    set ns [uplevel 1 [list ::namespace current]]

    set locale [string tolower $locale]

    dict set Msgs $ns $locale $src $dest

    return $dest
}

# msgcat::mcflset --
#
#	Set the translation for a given string in the current file locale.
#
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
#	pairs		One or more src/dest pairs (must be even length)
#
# Results:
#	Returns the number of pairs processed

proc msgcat::mcmset {locale pairs} {
    variable Msgs
    variable Merged

    set length [llength $pairs]
    if {$length % 2} {
	return -code error "bad translation list:\
		should be \"[lindex [info level 0] 0] locale {src dest ...}\""
    }

    set locale [string tolower $locale]
    set ns [uplevel 1 [list ::namespace current]]

    foreach {src dest} $pairs {
	dict set Msgs $ns $locale $src $dest
    }
    dict unset Merged $ns

    return [expr {$length / 2}]
}

# msgcat::mcflmset --
#
#	Set the translation for multiple strings in the mc file locale.







<













<







963
964
965
966
967
968
969

970
971
972
973
974
975
976
977
978
979
980
981
982

983
984
985
986
987
988
989
#	pairs		One or more src/dest pairs (must be even length)
#
# Results:
#	Returns the number of pairs processed

proc msgcat::mcmset {locale pairs} {
    variable Msgs


    set length [llength $pairs]
    if {$length % 2} {
	return -code error "bad translation list:\
		should be \"[lindex [info level 0] 0] locale {src dest ...}\""
    }

    set locale [string tolower $locale]
    set ns [uplevel 1 [list ::namespace current]]

    foreach {src dest} $pairs {
	dict set Msgs $ns $locale $src $dest
    }


    return [expr {$length / 2}]
}

# msgcat::mcflmset --
#
#	Set the translation for multiple strings in the mc file locale.

Changes to tests/msgcat.test.

807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
	} -result {1 0}

    # Tests msgcat-12.*: [mcpackagelocale]

	test msgcat-12.1 {mcpackagelocale no subcommand} -body {
	    mcpackagelocale
	} -returnCodes 1\
	-result {wrong # args: should be "mcpackagelocale subcommand ?locale? ?ns?"}

	test msgcat-12.2 {mclpackagelocale wrong subcommand} -body {
	    mcpackagelocale junk
	} -returnCodes 1\
	-result {unknown subcommand "junk": must be clear, get, isset, loaded, present, set, or unset}

	test msgcat-12.3 {mcpackagelocale set} -setup {







|







807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
	} -result {1 0}

    # Tests msgcat-12.*: [mcpackagelocale]

	test msgcat-12.1 {mcpackagelocale no subcommand} -body {
	    mcpackagelocale
	} -returnCodes 1\
	-result {wrong # args: should be "mcpackagelocale subcommand ?locale?"}

	test msgcat-12.2 {mclpackagelocale wrong subcommand} -body {
	    mcpackagelocale junk
	} -returnCodes 1\
	-result {unknown subcommand "junk": must be clear, get, isset, loaded, present, set, or unset}

	test msgcat-12.3 {mcpackagelocale set} -setup {