diff --git a/src/xercesc/util/Makefile.in b/src/xercesc/util/Makefile.in
index e337cc937c522b8f06faf0a9b206f4522db876ea..93963cb2784b6ddc54f6669b3f67eb2fa68c5c64 100644
--- a/src/xercesc/util/Makefile.in
+++ b/src/xercesc/util/Makefile.in
@@ -55,6 +55,9 @@
 #
 #
 # $Log$
+# Revision 1.16  2002/11/04 22:28:05  peiyongz
+# Locale setting for message loader
+#
 # Revision 1.15  2002/10/22 17:53:43  peiyongz
 # Build resource bundles on Unix
 #
@@ -521,6 +524,7 @@ UTIL_CPP_OBJECTS = \
     XMLEBCDICTranscoder.$(TO) \
     XMLException.$(TO) \
     XMLFloat.$(TO) \
+    XMLMsgLoader.$(TO) \
     XMLString.$(TO) \
     XMLUCSTranscoder.$(TO) \
     XMLUTF16Transcoder.$(TO) \
diff --git a/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.cpp b/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.cpp
index 0bccdb9f8537db86c27a061f52a36d603b8ffaf7..a60bb68a42e1ea23df897745bfc3eb97913ead01 100644
--- a/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.cpp
+++ b/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.cpp
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.6  2002/11/04 22:24:43  peiyongz
+ * Locale setting for message loader
+ *
  * Revision 1.5  2002/11/04 15:10:40  tng
  * C++ Namespace Support.
  *
@@ -112,6 +115,7 @@
 #include <xercesc/util/XMLMsgLoader.hpp>
 #include <xercesc/util/XMLString.hpp>
 #include <xercesc/util/XMLUniDefs.hpp>
+#include <xercesc/util/Janitor.hpp>
 #include "ICUMsgLoader.hpp"
 
 #include "string.h"
@@ -131,7 +135,9 @@ ICUMsgLoader::ICUMsgLoader(const XMLCh* const  msgDomain)
 :fLocaleBundle(0)
 ,fDomainBundle(0)
 {
-    // validation on msgDomain
+    /***
+	    Validate msgDomain
+    ***/
     if (!XMLString::equals(msgDomain, XMLUni::fgXMLErrDomain)    &&
         !XMLString::equals(msgDomain, XMLUni::fgExceptDomain)    &&
         !XMLString::equals(msgDomain, XMLUni::fgValidityDomain)   )
@@ -139,37 +145,54 @@ ICUMsgLoader::ICUMsgLoader(const XMLCh* const  msgDomain)
         XMLPlatformUtils::panic(XMLPlatformUtils::Panic_UnknownMsgDomain);
     }
 
-    char tempBuf[1024];
-    memset(tempBuf, 0, sizeof tempBuf);
-	char *location  = getenv("XERCESC_RESBUND_PKG_PATH");
+	/***
+	     Resolve domainName
+	***/
+	int          index = XMLString::lastIndexOf(msgDomain, chForwardSlash);
+	char*   domainName = XMLString::transcode(&(msgDomain[index + 1]));
+    ArrayJanitor<char> jan1(domainName);
+
+    /***
+	     Resolve location
+
+	     REVISIT: another approach would be: through some system API
+		          which returns the directory of the XercescLib and
+		          that directory would be used to locate the 
+		 		  resource bundle    
+    ***/
+    char locationBuf[1024];
+    memset(locationBuf, 0, sizeof locationBuf);
+	char *nlsHome = getenv("XERCESC_NLS_HOME");
 
-    if (location)
-		strcpy(tempBuf, location);
+    if (nlsHome)
+	{
+		strcpy(locationBuf, nlsHome);
+        strcat(locationBuf, U_FILE_SEP_STRING);
+	}
 
-    strcat(tempBuf, U_FILE_SEP_STRING);
-    strcat(tempBuf, "XercescErrMsg");
+    strcat(locationBuf, "XercescErrMsg");
 
+	/***
+	    Open the locale-specific resource bundle
+	***/
     UErrorCode err = U_ZERO_ERROR;
-    fLocaleBundle = ures_open(tempBuf, getenv("XERCESC_RESBUND_PKG_LOCALE"), &err);
+    fLocaleBundle = ures_open(locationBuf, XMLMsgLoader::getLocale(), &err);
     if (!U_SUCCESS(err) || fLocaleBundle == NULL)
     {
-        XMLPlatformUtils::panic(XMLPlatformUtils::Panic_CantLoadMsgDomain);
+         XMLPlatformUtils::panic(XMLPlatformUtils::Panic_CantLoadMsgDomain);
     }
 
-    /***
-        get the resource bundle for the domain
-        strip off path information, if any
-    ***/
-     int   index = XMLString::lastIndexOf(msgDomain, chForwardSlash);
-     char *domainName = XMLString::transcode(&(msgDomain[index + 1]));
-	 err = U_ZERO_ERROR;
-     fDomainBundle = ures_getByKey(fLocaleBundle, domainName, NULL, &err);
-     delete [] domainName;
-
-     if (!U_SUCCESS(err) || fDomainBundle == NULL)
-    {
-        XMLPlatformUtils::panic(XMLPlatformUtils::Panic_CantLoadMsgDomain);
-    }
+	/***
+	    Open the domain specific resource bundle within
+		the locale-specific resource bundle
+	***/
+	err = U_ZERO_ERROR;
+	fDomainBundle = ures_getByKey(fLocaleBundle, domainName, NULL, &err);
+ 
+	if (!U_SUCCESS(err) || fDomainBundle == NULL)
+	{
+         XMLPlatformUtils::panic(XMLPlatformUtils::Panic_CantLoadMsgDomain);
+	}
 
 }
 
diff --git a/src/xercesc/util/PlatformUtils.cpp b/src/xercesc/util/PlatformUtils.cpp
index 191ce81a2369101f2fef0468b0d2e162eba19fe0..c5b6afb198acc27db805f1873e58905972f323a6 100644
--- a/src/xercesc/util/PlatformUtils.cpp
+++ b/src/xercesc/util/PlatformUtils.cpp
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.4  2002/11/04 22:24:21  peiyongz
+ * Locale setting for message loader
+ *
  * Revision 1.3  2002/11/04 15:22:04  tng
  * C++ Namespace Support.
  *
@@ -187,7 +190,7 @@ XMLTransService*    XMLPlatformUtils::fgTransService = 0;
 // ---------------------------------------------------------------------------
 //  XMLPlatformUtils: Init/term methods
 // ---------------------------------------------------------------------------
-void XMLPlatformUtils::Initialize()
+void XMLPlatformUtils::Initialize(const char* const locale)
 {
     //
     //  Effects of overflow:
@@ -261,6 +264,25 @@ void XMLPlatformUtils::Initialize()
     //  a zero pointer if this platform doesn't want to support this.
     //
     fgNetAccessor = makeNetAccessor();
+
+    /***
+     *  Locale setting for Message Loader
+     *
+     *  Noticed: The locale is set iff the Initialize() is invoked for the 
+     *           very first time, thus to ensure that each and every message 
+     *           loaders, in this process space, share the same locale.
+     *
+     *           All subsequent invocations of Initialize() have no effect on the 
+     *           message loaders, either instantiated, or to be instantiated.
+     *
+     *           To set to a different locale, client application needs to 
+     *           Terminate() (or multiple Terminate() in the case where multiple
+     *           Initialize() have been invoked before) and then followed by an
+     *           Initialize(new_locale).
+     *
+     ***/
+    XMLMsgLoader::setLocale(locale);
+
 }
 
 
@@ -317,8 +339,16 @@ void XMLPlatformUtils::Terminate()
     //
     platformTerm();
 
+    /***
+     *  de-allocate resource
+     *
+     *  refer to discussion in the Initialize()
+     ***/
+    XMLMsgLoader::setLocale(0);
+
     // And say we are no longer initialized
     gInitFlag = 0;
+
 }
 
 
diff --git a/src/xercesc/util/PlatformUtils.hpp b/src/xercesc/util/PlatformUtils.hpp
index a18765a12400257f4ba38b809e63bf8dbd03f4c1..25b07b28e96045d13b0a8046355eaa80c1d77ca7 100644
--- a/src/xercesc/util/PlatformUtils.hpp
+++ b/src/xercesc/util/PlatformUtils.hpp
@@ -158,7 +158,7 @@ public :
       *
       * Initialization <b>must</b> be called first in any client code.
       */
-    static void Initialize();
+    static void Initialize(const char* const locale = XMLUni::fgXercescDefaultLocale);
 
     /** Perform per-process parser termination
       *
diff --git a/src/xercesc/util/XMLMsgLoader.cpp b/src/xercesc/util/XMLMsgLoader.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..760db118dda4c03bd5e715d5b61a0dde1f981eff
--- /dev/null
+++ b/src/xercesc/util/XMLMsgLoader.cpp
@@ -0,0 +1,139 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Xerces" and "Apache Software Foundation" must
+ *    not be used to endorse or promote products derived from this
+ *    software without prior written permission. For written
+ *    permission, please contact apache\@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    nor may "Apache" appear in their name, without prior written
+ *    permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation, and was
+ * originally based on software copyright (c) 1999, International
+ * Business Machines, Inc., http://www.ibm.com .  For more information
+ * on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+/*
+ *  $Id$
+ * $Log$
+ * Revision 1.1  2002/11/04 22:24:21  peiyongz
+ * Locale setting for message loader
+ *
+ *
+ */
+
+// ---------------------------------------------------------------------------
+//  Includes
+// ---------------------------------------------------------------------------
+#include <xercesc/util/XMLMsgLoader.hpp>
+#include <xercesc/util/XMLString.hpp>
+#include <xercesc/util/XMLUniDefs.hpp>
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+/***
+ *   The PlatformUtils::initialize() would set fLocale
+ *   to either a user-privded string or 0
+ *
+ ***/
+char* XMLMsgLoader::fLocale = 0;
+
+XMLCh XMLMsgLoader::fLanguage[] = {chLatin_e, chLatin_n, chNull};
+
+/***
+ *  if localeToAdopt is 0, that is to release memory for
+ *  the user defined locale string
+ *
+ ***/
+void  XMLMsgLoader::setLocale(const char* const localeToAdopt)
+{
+    /***
+     * Release the current setting's memory, if any
+     ***/
+	if (fLocale)
+	{
+		delete [] fLocale;
+		fLocale = 0;
+	}
+
+    /***
+     *  
+     *  REVISIT: later we may do locale format checking
+     * 
+     *           refer to phttp://oss.software.ibm.com/icu/userguide/locale.html
+     *           for details.
+     */
+	if (localeToAdopt)
+	{
+		fLocale   = XMLString::replicate(localeToAdopt);
+        XMLString::transcode(fLocale, fLanguage, 2);
+        fLanguage[2] = 0;
+    }
+
+}
+
+const char* XMLMsgLoader::getLocale()
+{
+	return fLocale;
+}
+
+// ---------------------------------------------------------------------------
+//  Deprecated
+//
+//     These two methods are deprecated.
+//  
+//     The default implementations for these two methods are provided as is,
+//     any specific derivative may change this as and when necessary.
+//      
+// ---------------------------------------------------------------------------
+const XMLCh* XMLMsgLoader::getLanguageName() const
+{
+    return fLanguage;
+}
+
+void XMLMsgLoader::setLanguageName(XMLCh* const)
+{
+}
+
+XERCES_CPP_NAMESPACE_END
diff --git a/src/xercesc/util/XMLMsgLoader.hpp b/src/xercesc/util/XMLMsgLoader.hpp
index 7a43d1d3750b67409b5573030b3ef5b4425f3ce5..afd1ca4dc50c7ce7e73375d96d98ea469d7253f4 100644
--- a/src/xercesc/util/XMLMsgLoader.hpp
+++ b/src/xercesc/util/XMLMsgLoader.hpp
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.3  2002/11/04 22:24:21  peiyongz
+ * Locale setting for message loader
+ *
  * Revision 1.2  2002/11/04 15:22:05  tng
  * C++ Namespace Support.
  *
@@ -161,11 +164,27 @@ public :
         , const char* const     repText4 = 0
     ) = 0;
 
+    /** @name Locale Handling  */
+    //@{
+	/**
+      * This function enables set the locale information which
+      * all concrete message loaders shall refer to during instantiation.
+      *
+      * Note: for detailed discussion, refer to PlatformUtils::initalize()
+      */
+    static void           setLocale(const char* const localeToAdopt);
+
+    /**
+      * Fr the derived to retrieve locale info during construction
+      */
+    static const char*    getLocale();
+
+    //@}
 
     // -----------------------------------------------------------------------
-    //  Getter methods
+    //  Deprecated: Getter methods
     // -----------------------------------------------------------------------
-    const XMLCh* getLanguageName() const;
+    virtual const XMLCh* getLanguageName() const;
 
 
 protected :
@@ -174,13 +193,11 @@ protected :
     // -----------------------------------------------------------------------
     XMLMsgLoader();
 
-
     // -----------------------------------------------------------------------
-    //  Protected helper methods
+    //  Deprecated: Protected helper methods
     // -----------------------------------------------------------------------
     void setLanguageName(XMLCh* const nameToAdopt);
 
-
 private :
     // -----------------------------------------------------------------------
     //  Unimplemented constructors and operators
@@ -192,12 +209,13 @@ private :
     // -----------------------------------------------------------------------
     //  Private data members
     //
-    //  fLanguage
-    //      This is the language that is represented by this instance of the
-    //      loader. The derived class must pass this through for storage and
-    //      we adopt it and delete it when we go.
+    //  fLocale
+    //      Locale info set through PlatformUtils::init().
+    //      The derived class may refer to this for locale information.
+    //
     // -----------------------------------------------------------------------
-    XMLCh*  fLanguage;
+    static char*    fLocale;
+    static XMLCh    fLanguage[];
 };
 
 
@@ -206,36 +224,14 @@ private :
 // ---------------------------------------------------------------------------
 inline XMLMsgLoader::~XMLMsgLoader()
 {
-    delete [] fLanguage;
 }
 
 
 // ---------------------------------------------------------------------------
 //  XMLMsgLoader: Hidden Constructors
 // ---------------------------------------------------------------------------
-inline XMLMsgLoader::XMLMsgLoader() :
-
-    fLanguage(0)
-{
-}
-
-
-// ---------------------------------------------------------------------------
-//  XMLMsgLoader: Getter methods
-// ---------------------------------------------------------------------------
-inline const XMLCh* XMLMsgLoader::getLanguageName() const
-{
-    return fLanguage;
-}
-
-
-// ---------------------------------------------------------------------------
-//  XMLMsgLoader: Protected helper methods
-// ---------------------------------------------------------------------------
-inline void XMLMsgLoader::setLanguageName(XMLCh* const nameToAdopt)
+inline XMLMsgLoader::XMLMsgLoader()
 {
-    delete [] fLanguage;
-    fLanguage = nameToAdopt;
 }
 
 XERCES_CPP_NAMESPACE_END
diff --git a/src/xercesc/util/XMLUni.cpp b/src/xercesc/util/XMLUni.cpp
index d148af072f0a77115a98e4f8cb89e21be84cd304..b6f8203f58164b5265374764ed42b60f65360a43 100644
--- a/src/xercesc/util/XMLUni.cpp
+++ b/src/xercesc/util/XMLUni.cpp
@@ -1199,5 +1199,8 @@ const XMLCh XMLUni::fgDOMWRTWhitespaceInElementContent[] =
 	chLatin_n, chLatin_t, chLatin_e, chLatin_n, chLatin_t, chNull
 };
 
+// en_US
+const char XMLUni::fgXercescDefaultLocale[] = "en_US";
+
 XERCES_CPP_NAMESPACE_END
 
diff --git a/src/xercesc/util/XMLUni.hpp b/src/xercesc/util/XMLUni.hpp
index 97595b481e7ed7272293dff079c39513762e3d14..4a5cc39448bd6acd935ff6d80053a9f966efec00 100644
--- a/src/xercesc/util/XMLUni.hpp
+++ b/src/xercesc/util/XMLUni.hpp
@@ -254,17 +254,19 @@ public :
     static const XMLCh fgDOMValidation[];
     static const XMLCh fgDOMWhitespaceInElementContent[];
 
-	// Introduced in DOM Level 3
-	// DOMWriter feature
-	static const XMLCh fgDOMWRTCanonicalForm[];
-	static const XMLCh fgDOMWRTDiscardDefaultContent[];
-	static const XMLCh fgDOMWRTEntities[];
-	static const XMLCh fgDOMWRTFormatPrettyPrint[];
-	static const XMLCh fgDOMWRTNormalizeCharacters[];
-	static const XMLCh fgDOMWRTSplitCdataSections[];
-	static const XMLCh fgDOMWRTValidation[];
-	static const XMLCh fgDOMWRTWhitespaceInElementContent[];
+    // Introduced in DOM Level 3
+    // DOMWriter feature
+    static const XMLCh fgDOMWRTCanonicalForm[];
+    static const XMLCh fgDOMWRTDiscardDefaultContent[];
+    static const XMLCh fgDOMWRTEntities[];
+    static const XMLCh fgDOMWRTFormatPrettyPrint[];
+    static const XMLCh fgDOMWRTNormalizeCharacters[];
+    static const XMLCh fgDOMWRTSplitCdataSections[];
+    static const XMLCh fgDOMWRTValidation[];
+    static const XMLCh fgDOMWRTWhitespaceInElementContent[];
 
+    // Locale
+    static const char  fgXercescDefaultLocale[];
 };
 
 XERCES_CPP_NAMESPACE_END