Tcl Source Code

Artifact [8ff1deafbb]
Login

Artifact 8ff1deafbbdcb1fabf00b4030cb1fcf5b1c4e6d9:

Attachment "msgcat.tcl.diff" to ticket [3544988fff] added by oehhar 2012-09-05 19:19:43.
--- C:/test/tcl8.6b2/library/msgcat/msgcat-ori.tcl	Mon Aug 27 19:24:55 2012
+++ C:/test/tcl8.6b2/library/msgcat/msgcat.tcl	Wed Sep 05 11:46:16 2012
@@ -25,10 +25,7 @@
     # Records the list of locales to search
     variable Loclist {}
 
-    # Records the locale of the currently sourced message catalogue file; this
-    # would be problematic if anyone were to recursively load a message
-    # catalog for a different locale from inside a catalog, but that's not a
-    # case that we really need to worry about.
+    # Records the locale of the currently sourced message catalogue file
     variable FileLocale
 
     # Records the mapping between source strings and translated strings.  The
@@ -284,6 +281,10 @@
 
 proc msgcat::mcload {langdir} {
     variable FileLocale
+    # Save the file locale if we are recursively called
+    if {[info exists FileLocale]} {
+	set nestedFileLocale $FileLocale
+    }
     set x 0
     foreach p [mcpreferences] {
 	if { $p eq {} } {
@@ -299,6 +300,9 @@
 	    uplevel 1 [list ::source -encoding utf-8 $langfile]
 	    unset FileLocale
 	}
+    }
+    if {[info exists nestedFileLocale]} {
+	set FileLocale $nestedFileLocale
     }
     return $x
 }