--- C:/Tcl85/lib/tcl8/8.5/msgcat-1.5.0.tm	Mon Jul 16 16:05:56 2012
+++ C:/Tcl85/lib/tcl8/8.5/msgcat-1.5.1.tm	Wed Jul 25 16:27:43 2012
@@ -13,11 +13,11 @@
 package require Tcl 8.5
 # When the version number changes, be sure to update the pkgIndex.tcl file,
 # and the installation directory in the Makefiles.
-package provide msgcat 1.5.0
+package provide msgcat 1.5.1
 
 namespace eval msgcat {
-    namespace export mcconfig mc mcload mclocale mcmax mcmset mcpreferences \
-	    mcset mcunknown
+    namespace export mcconfig mc mcload mclocale mcmax mcmset mcflset\
+	    mcpreferences mcset mcflset mcunknown
 
     # Records the current locale as passed to mclocale
     variable Locale ""
@@ -28,6 +28,9 @@
     # List of file pattern to load in addition to Loclist.
     variable Patternlist {}
 
+    # Locale of currently sourced message catalogue file
+    variable MCFileLocale ""
+
     # Records the mapping between source strings and translated strings.  The
     # dict key is of the form "<locale> <namespace> <src>", where locale and
     # namespace should be themselves dict values and the value is
@@ -174,6 +177,10 @@
 #	Available options are:
 #	-pattern
 #	    List of file pattern to load in addition to mcpreferences
+#	-mcfilelocale
+#	    Locale extracted from the file name of a message file which is
+#	    currently sourced.
+#	    This locale is used by the commands mcflset and mcflmset.
 #
 # Arguments:
 #	option	The name of the option
@@ -184,15 +191,18 @@
 
 proc msgcat::mcconfig {args} {
     variable Patternlist
+    variable MCFileLocale
     if {1 == [llength $args]} {
 	switch -exact -- [lindex $args] {
 	    -pattern { return $Patternlist}
+	    -mcfilelocale { return $MCFileLocale}
 	    default { return -code error "Unknown option" }
 	}
     }
     dict for {option value} $args {
 	switch -exact -- $option {
 	    -pattern { set Patternlist $value }
+	    -mcfilelocale { set MCFileLocale [string tolower $value] }
 	    default { return -code error "Unknown option" }
 	}
     }
@@ -313,6 +323,7 @@
 
 proc msgcat::mcload {langdir} {
     variable Patternlist
+    variable MCFileLocale
     set x 0
     set filelist {}
     foreach pattern [lsort -unique [concat [mcpreferences] $Patternlist]] {
@@ -324,6 +335,10 @@
     }
     foreach langfile [lsort -unique $filelist] {
 	incr x
+	set MCFileLocale [string tolower [file tail [file rootname $langfile]]]
+	if {"root" eq $MCFileLocale} {
+	    set MCFileLocale ""
+	}
 	uplevel 1 [list ::source -encoding utf-8 $langfile]
     }
     return $x
@@ -356,6 +371,31 @@
     return $dest
 }
 
+# msgcat::mcflset --
+#
+#	Set the translation for a given string in the current MC file locale.
+#
+# Arguments:
+#	src		The source string.
+#	dest		(Optional) The translated string.  If omitted,
+#			the source string is used.
+#
+# Results:
+#	Returns the new locale.
+
+proc msgcat::mcflset {src {dest ""}} {
+    variable MCFileLocale
+    variable Msgs
+    if {[llength [info level 0]] == 2} { ;# dest not specified
+	set dest $src
+    }
+
+    set ns [uplevel 1 [list ::namespace current]]
+
+    dict set Msgs $MCFileLocale $ns $src $dest
+    return $dest
+}
+
 # msgcat::mcmset --
 #
 #	Set the translation for multiple strings in a specified locale.
@@ -381,6 +421,35 @@
 
     foreach {src dest} $pairs {
 	dict set Msgs $locale $ns $src $dest
+    }
+
+    return $length
+}
+
+# msgcat::mcflmset --
+#
+#	Set the translation for multiple strings in the mc file locale.
+#
+# Arguments:
+#	pairs		One or more src/dest pairs (must be even length)
+#
+# Results:
+#	Returns the number of pairs processed
+
+proc msgcat::mcflmset {pairs } {
+    variable MCFileLocale
+    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 ns [uplevel 1 [list ::namespace current]]
+
+    foreach {src dest} $pairs {
+	dict set Msgs $MCFileLocale $ns $src $dest
     }
 
     return $length
