Index: doc/msgcat.n
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/msgcat.n,v
retrieving revision 1.16
diff -b -u -r1.16 msgcat.n
--- doc/msgcat.n	1 Jul 2002 18:24:39 -0000	1.16
+++ doc/msgcat.n	20 Oct 2003 21:26:20 -0000
@@ -7,7 +7,7 @@
 '\" SCCS: @(#) msgcat.n
 '\" 
 .so man.macros
-.TH "msgcat" n 1.3 msgcat "Tcl Bundled Packages"
+.TH "msgcat" n 1.4 msgcat "Tcl Bundled Packages"
 .BS
 '\" Note:  do not modify the .SH NAME line immediately below!
 .SH NAME
@@ -15,7 +15,7 @@
 .SH SYNOPSIS
 \fBpackage require Tcl 8.2\fR
 .sp
-\fBpackage require msgcat 1.3\fR
+\fBpackage require msgcat 1.4\fR
 .sp
 \fB::msgcat::mc \fIsrc-string\fR ?\fIarg arg ...\fR?
 .sp
@@ -94,7 +94,9 @@
 locale set in msgcat by \fBmsgcat::mclocale\fR, and
 cannot be set independently.  For example, if the
 current locale is en_US_funky, then \fBmsgcat::mcpreferences\fR
-returns {en_US_funky en_US en}.
+.VS 1.4
+returns \fB{en_US_funky en_US en {}}\fR.
+.VE
 .TP
 \fB::msgcat::mcload \fIdirname\fR
 Searches the specified directory for files that match
@@ -167,10 +169,13 @@
 .PP
 When a locale is specified by the user, a ``best match'' search is
 performed during string translation.  For example, if a user specifies
-en_GB_Funky, the locales ``en_GB_Funky'', ``en_GB'', and ``en'' are
-searched in order until a matching translation string is found.  If no
-translation string is available, then \fB::msgcat::unknown\fR is
-called.
+.VS 1.4
+en_GB_Funky, the locales ``en_GB_Funky'', ``en_GB'', ``en'' and ``''
+(the empty string)
+.VE
+are searched in order until a matching translation
+string is found.  If no translation string is available, then
+\fB::msgcat::unknown\fR is called.
 
 .SH "NAMESPACES AND MESSAGE CATALOGS"
 .PP
@@ -236,6 +241,12 @@
 es.msg    -- spanish
 en_gb.msg -- United Kingdom English
 .CE
+.VS
+\fIException:\fR The message file for the root locale ``'' is
+called \fBROOT.msg\fR.  This exception is made so as not to
+cause peculiar behavior, such as marking the message file as
+``hidden'' on Unix file systems.
+.VE
 .IP [3]
 The file contains a series of calls to \fBmcset\fR and
 \fBmcmset\fR, setting the necessary translation strings
Index: library/msgcat/msgcat.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/library/msgcat/msgcat.tcl,v
retrieving revision 1.18
diff -b -u -r1.18 msgcat.tcl
--- library/msgcat/msgcat.tcl	6 Aug 2003 23:02:05 -0000	1.18
+++ library/msgcat/msgcat.tcl	20 Oct 2003 21:26:20 -0000
@@ -15,7 +15,7 @@
 package require Tcl 8.2
 # When the version number changes, be sure to update the pkgIndex.tcl file,
 # and the installation directory in the Makefiles.
-package provide msgcat 1.3.1
+package provide msgcat 1.4
 
 namespace eval msgcat {
     namespace export mc mcload mclocale mcmax mcmset mcpreferences mcset \
@@ -234,6 +234,7 @@
 	    set word [string trimleft "${word}_${part}" _]
 	    set Loclist [linsert $Loclist 0 $word]
 	}
+	lappend Loclist {}
     }
     return $Locale
 }
@@ -268,6 +269,9 @@
 proc msgcat::mcload {langdir} {
     set x 0
     foreach p [mcpreferences] {
+	if { $p eq {} } {
+	    set p ROOT
+        }
 	set langfile [file join $langdir $p.msg]
 	if {[file exists $langfile]} {
 	    incr x
Index: tests/msgcat.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/msgcat.test,v
retrieving revision 1.12
diff -b -u -r1.12 msgcat.test
--- tests/msgcat.test	26 Mar 2003 22:55:44 -0000	1.12
+++ tests/msgcat.test	20 Oct 2003 21:26:20 -0000
@@ -19,8 +19,8 @@
     puts stderr "Skipping tests in [info script].  tcltest 2 required."
     return
 }
-if {[catch {package require msgcat 1.3}]} {
-    puts stderr "Skipping tests in [info script].  No msgcat 1.3 found to test."
+if {[catch {package require msgcat 1.4}]} {
+    puts stderr "Skipping tests in [info script].  No msgcat 1.4 found to test."
     return
 }
 
@@ -111,7 +111,7 @@
 	mclocale $locale
     } -body {
 	mcpreferences
-    } -result en
+    } -result {en {}}
 
     test msgcat-1.6 {mclocale set, two elements} -setup {
 	variable locale [mclocale]
@@ -137,7 +137,7 @@
 	mclocale $locale
     } -body {
 	mcpreferences
-    } -result {en_us en}
+    } -result {en_us en {}}
 
     test msgcat-1.9 {mclocale set, three elements} -setup {
 	variable locale [mclocale]
@@ -163,7 +163,7 @@
 	mclocale $locale
     } -body {
 	mcpreferences
-    } -result {en_us_funky en_us en}
+    } -result {en_us_funky en_us en {}}
 
     # Tests msgcat-2.*: [mcset], [mcmset], namespace partitioning
 
@@ -246,9 +246,10 @@
     # (e.g. en_UK) will search less specific locales
     # (e.g. en) for translation strings.
     #
-    # Do this for the 12 permutations of
+    # Do this for the 15 permutations of
     #     locales: {foo foo_BAR foo_BAR_baz}
-    #     strings: {ov1 ov2 ov3 ov4}
+    #     strings: {ov0 ov1 ov2 ov3 ov4}
+    #	  locale ROOT        defines ov0, ov1, ov2, ov3
     #     locale foo         defines ov1, ov2, ov3
     #     locale foo_BAR     defines      ov2, ov3
     #     locale foo_BAR_BAZ defines           ov3
@@ -264,16 +265,23 @@
     variable count 2
     variable result
     array set result {
-	foo,ov1 ov1_foo foo,ov2 ov2_foo foo,ov3 ov3_foo foo,ov4 ov4
-	foo_BAR,ov1 ov1_foo foo_BAR,ov2 ov2_foo_BAR foo_BAR,ov3 ov3_foo_BAR
-	foo_BAR,ov4 ov4 foo_BAR_baz,ov1 ov1_foo foo_BAR_baz,ov2 ov2_foo_BAR
+	foo,ov0 ov0_ROOT foo,ov1 ov1_foo foo,ov2 ov2_foo 
+        foo,ov3 ov3_foo foo,ov4 ov4
+	foo_BAR,ov0 ov0_ROOT foo_BAR,ov1 ov1_foo foo_BAR,ov2 ov2_foo_BAR 
+        foo_BAR,ov3 ov3_foo_BAR	foo_BAR,ov4 ov4 
+        foo_BAR_baz,ov0 ov0_ROOT foo_BAR_baz,ov1 ov1_foo 
+        foo_BAR_baz,ov2 ov2_foo_BAR
 	foo_BAR_baz,ov3 ov3_foo_BAR_baz foo_BAR_baz,ov4 ov4
     }
     variable loc
     variable string
     foreach loc {foo foo_BAR foo_BAR_baz} {
-	foreach string {ov1 ov2 ov3 ov4} {
+	foreach string {ov0 ov1 ov2 ov3 ov4} {
 	    test msgcat-3.$count {mcset, overlap} -setup {
+		mcset {} ov0 ov0_ROOT
+		mcset {} ov1 ov1_ROOT
+		mcset {} ov2 ov2_ROOT
+		mcset {} ov3 ov3_ROOT
 		mcset foo ov1 ov1_foo
 		mcset foo ov2 ov2_foo
 		mcset foo ov3 ov3_foo
@@ -364,9 +372,12 @@
 
     # Tests msgcat-5.*: [mcload]
 
-    variable locales {foo foo_BAR foo_BAR_baz}
+    variable locales {{} foo foo_BAR foo_BAR_baz}
     makeDirectory msgdir
     foreach loc $locales {
+	if { $loc eq {} } {
+	    set loc ROOT
+        }
 	makeFile "::msgcat::mcset $loc abc abc-$loc" \
 		[string tolower [file join msgdir $loc.msg]]
     }
@@ -379,12 +390,12 @@
 	    mclocale $locale
 	} -body {
 	    mcload [file join [temporaryDirectory] msgdir]
-	} -result $count
+	} -result [expr { $count+1 }]
 	incr count
     }
 
     # Even though foo_BAR_notexist does not exist,
-    # foo_BAR and foo should be loaded.
+    # foo_BAR, foo and the root should be loaded.
 	test msgcat-5.4 {mcload} -setup {
 	    variable locale [mclocale]
 	    mclocale foo_BAR_notexist
@@ -392,7 +403,7 @@
 	    mclocale $locale
 	} -body {
 	    mcload [file join [temporaryDirectory] msgdir]
-	} -result 2
+	} -result 3
 
 	test msgcat-5.5 {mcload} -setup {
 	    variable locale [mclocale]
@@ -401,7 +412,7 @@
 	    mclocale $locale
 	} -body {
 	    mcload [file join [temporaryDirectory] msgdir]
-	} -result 0
+	} -result 1
 
 	test msgcat-5.6 {mcload} -setup {
 	    variable locale [mclocale]
Index: tools/tcl.wse.in
===================================================================
RCS file: /cvsroot/tcl/tcl/tools/tcl.wse.in,v
retrieving revision 1.47
diff -b -u -r1.47 tcl.wse.in
--- tools/tcl.wse.in	4 Mar 2003 23:46:14 -0000	1.47
+++ tools/tcl.wse.in	20 Oct 2003 21:26:21 -0000
@@ -1063,12 +1063,12 @@
 end
 item: Install File
   Source=${__TCLBASEDIR__}\library\msgcat\pkgIndex.tcl
-  Destination=%MAINDIR%\lib\tcl%VER%\msgcat1.2\pkgIndex.tcl
+  Destination=%MAINDIR%\lib\tcl%VER%\msgcat1.4\pkgIndex.tcl
   Flags=0000000010000010
 end
 item: Install File
   Source=${__TCLBASEDIR__}\library\msgcat\msgcat.tcl
-  Destination=%MAINDIR%\lib\tcl%VER%\msgcat1.2\msgcat.tcl
+  Destination=%MAINDIR%\lib\tcl%VER%\msgcat1.4\msgcat.tcl
   Flags=0000000010000010
 end
 item: Install File
Index: unix/Makefile.in
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/Makefile.in,v
retrieving revision 1.132
diff -b -u -r1.132 Makefile.in
--- unix/Makefile.in	23 Jul 2003 15:40:26 -0000	1.132
+++ unix/Makefile.in	20 Oct 2003 21:26:21 -0000
@@ -632,7 +632,7 @@
 		else true; \
 		fi; \
 	    done;
-	@for i in http2.4 http1.0 opt0.4 encoding msgcat1.3 tcltest2.2; \
+	@for i in http2.4 http1.0 opt0.4 encoding msgcat1.4 tcltest2.2; \
 	    do \
 	    if [ ! -d $(SCRIPT_INSTALL_DIR)/$$i ] ; then \
 		echo "Making directory $(SCRIPT_INSTALL_DIR)/$$i"; \
@@ -670,10 +670,10 @@
 	    do \
 	    $(INSTALL_DATA) $$j $(SCRIPT_INSTALL_DIR)/opt0.4; \
 	    done;
-	@echo "Installing library msgcat1.3 directory";
+	@echo "Installing library msgcat1.4 directory";
 	@for j in $(TOP_DIR)/library/msgcat/*.tcl ; \
 	    do \
-	    $(INSTALL_DATA) $$j $(SCRIPT_INSTALL_DIR)/msgcat1.3; \
+	    $(INSTALL_DATA) $$j $(SCRIPT_INSTALL_DIR)/msgcat1.4; \
 	    done;
 	@echo "Installing library tcltest2.2 directory";
 	@for j in $(TOP_DIR)/library/tcltest/*.tcl ; \
Index: win/Makefile.in
===================================================================
RCS file: /cvsroot/tcl/tcl/win/Makefile.in,v
retrieving revision 1.73
diff -b -u -r1.73 Makefile.in
--- win/Makefile.in	25 Jun 2003 23:02:11 -0000	1.73
+++ win/Makefile.in	20 Oct 2003 21:26:21 -0000
@@ -521,7 +521,7 @@
 		else true; \
 		fi; \
 	    done;
-	@for i in http1.0 http2.4 opt0.4 encoding msgcat1.3 tcltest2.2; \
+	@for i in http1.0 http2.4 opt0.4 encoding msgcat1.4 tcltest2.2; \
 	    do \
 	    if [ ! -d $(SCRIPT_INSTALL_DIR)/$$i ] ; then \
 		echo "Making directory $(SCRIPT_INSTALL_DIR)/$$i"; \
@@ -555,10 +555,10 @@
 	    do \
 	    $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/opt0.4"; \
 	    done;
-	@echo "Installing library msgcat1.3 directory";
+	@echo "Installing library msgcat1.4 directory";
 	@for j in $(ROOT_DIR)/library/msgcat/*.tcl; \
 	    do \
-	    $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/msgcat1.3"; \
+	    $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/msgcat1.4"; \
 	    done;
 	@echo "Installing library tcltest2.2 directory";
 	@for j in $(ROOT_DIR)/library/tcltest/*.tcl; \
Index: win/makefile.bc
===================================================================
RCS file: /cvsroot/tcl/tcl/win/makefile.bc,v
retrieving revision 1.16
diff -b -u -r1.16 makefile.bc
--- win/makefile.bc	25 Jun 2003 23:02:11 -0000	1.16
+++ win/makefile.bc	20 Oct 2003 21:26:21 -0000
@@ -433,10 +433,10 @@
 	-@$(MKDIR) "$(SCRIPT_INSTALL_DIR)\opt0.4"
 	-@copy "$(ROOT)\library\opt\optparse.tcl" "$(SCRIPT_INSTALL_DIR)\opt0.4"
 	-@copy "$(ROOT)\library\opt\pkgIndex.tcl" "$(SCRIPT_INSTALL_DIR)\opt0.4"
-	@echo installing msgcat1.3
-	-@$(MKDIR) "$(SCRIPT_INSTALL_DIR)\msgcat1.3"
-	-@copy "$(ROOT)\library\msgcat\msgcat.tcl"   "$(SCRIPT_INSTALL_DIR)\msgcat1.3"
-	-@copy "$(ROOT)\library\msgcat\pkgIndex.tcl" "$(SCRIPT_INSTALL_DIR)\msgcat1.3"
+	@echo installing msgcat1.4
+	-@$(MKDIR) "$(SCRIPT_INSTALL_DIR)\msgcat1.4"
+	-@copy "$(ROOT)\library\msgcat\msgcat.tcl"   "$(SCRIPT_INSTALL_DIR)\msgcat1.4"
+	-@copy "$(ROOT)\library\msgcat\pkgIndex.tcl" "$(SCRIPT_INSTALL_DIR)\msgcat1.4"
 	@echo installing tcltest2.2
 	-@$(MKDIR) "$(SCRIPT_INSTALL_DIR)\tcltest2.2"
 	-@copy "$(ROOT)\library\tcltest\tcltest.tcl"   "$(SCRIPT_INSTALL_DIR)\tcltest2.2"
Index: win/makefile.vc
===================================================================
RCS file: /cvsroot/tcl/tcl/win/makefile.vc,v
retrieving revision 1.111
diff -b -u -r1.111 makefile.vc
--- win/makefile.vc	9 Oct 2003 00:29:27 -0000	1.111
+++ win/makefile.vc	20 Oct 2003 21:26:21 -0000
@@ -773,9 +773,9 @@
 	@echo installing opt0.4
 	@$(CPY) "$(ROOT)\library\opt\*.tcl" \
 		"$(SCRIPT_INSTALL_DIR)\opt0.4\"
-	@echo installing msgcat1.3
+	@echo installing msgcat1.4
 	@$(CPY) "$(ROOT)\library\msgcat\*.tcl" \
-	    "$(SCRIPT_INSTALL_DIR)\msgcat1.3\"
+	    "$(SCRIPT_INSTALL_DIR)\msgcat1.4\"
 	@echo installing tcltest2.2 
 	@$(CPY) "$(ROOT)\library\tcltest\*.tcl" \
 	    "$(SCRIPT_INSTALL_DIR)\tcltest2.2\"
