Edit C:\Windows\security\msscw\TransformFiles\scwxmlLoc.xsl
<?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:msftscw="http://www.microsoft.com/windows/security/" version="1.0"> <msxsl:script language="JScript" implements-prefix="msftscw"><![CDATA[ /////////////////////////////////////////////////////////////////////////////// // // Object: localization // // Synopsis: A wrapper object to encapsulate the process of loading a // localization XML file and grabbing a string from it // // Public Methods: isLoaded - Is the loc file loaded? // loadXML - Load the XML file the loc strings // getLocString - Get the localized string from the XML // /////////////////////////////////////////////////////////////////////////////// function localization() { //------------------------------------------------------------------------- // Internal variables //------------------------------------------------------------------------- var m_pDoc = null; var m_bFound = false; var m_strName = ""; //------------------------------------------------------------------------- // Public methods //------------------------------------------------------------------------- this.isLoaded = isLoaded; this.loadXML = loadXML; this.getLocString = getLocString; this.setName = setName; this.getName = getName; function setName(strName) { m_strName = strName; return m_strName; } function getName() { return m_strName; } //------------------------------------------------------------------------- // // Method: isLoaded // // Arguments: none // // Returns: (bool) - True if loadXML has been called and the file was // loaded // //------------------------------------------------------------------------- function isLoaded() { return m_bFound; } //------------------------------------------------------------------------- // // Method: loadXML // // Arguments: (string) strFile - XML file to load // // Returns: (bool) - true the file was loaded // //------------------------------------------------------------------------- function loadXML(strFile) { // If been here before then display a warning if(m_bFound) { m_bFound = false; } //--------------------------------------------------------------------- // Load XMLDOM //--------------------------------------------------------------------- if(null == m_pDoc) { m_pDoc = new ActiveXObject("MSXML2.DOMDocument"); } //--------------------------------------------------------------------- // Get the loc file //--------------------------------------------------------------------- if(m_pDoc) { m_pDoc.async = false; m_bFound = m_pDoc.load(strFile); } return m_bFound; } //------------------------------------------------------------------------- // // Method: getLocString // // Arguments: (string) strNode - XPath to node to query // // Returns: (string) - The requested string, else null // //------------------------------------------------------------------------- function getLocString(strNode) { var strLogString = getNodeTextFromString(strNode, m_pDoc); if ( strLogString == null ) { strLogString = "error translating"; } return strLogString; } } function getLocObject(strFile) { var nIndex = 0; var bFound = false; var strRet = ""; var LocObject = null; if(m_arrObjs) { for(nIndex = 0; nIndex < m_arrObjs.length; nIndex++) { if(strFile == m_arrObjs[nIndex].getName() ) { bFound = true; LocObject = m_arrObjs[nIndex]; break; } } } return LocObject; } //------------------------------------------------------------------------- // // Method: GetUserLanguage // // Arguments: (string) strFile - XML file to load // // Returns: (string) - language id // //------------------------------------------------------------------------- var m_pLanguageDoc = null; function GetUserLanguage(strFile) { if(null == m_pLanguageDoc) { m_pLanguageDoc = new ActiveXObject("MSXML2.DOMDocument"); } var strLangauge = ""; //--------------------------------------------------------------------- // Get the loc file //--------------------------------------------------------------------- if(m_pLanguageDoc) { m_pLanguageDoc.async = false; if( m_pLanguageDoc.load(strFile) ) { var strPath = "SCWVariables//SCWXSLVariable[@name=\'UserUILanguage\']"; strLangauge = getNodeAttribute(m_pLanguageDoc,strPath,"value"); if( null == strLangauge ) { strLangauge = ""; } } } return strLangauge; } //----------------------------------------------------------------------------- // // Method: getString // // Arguments: (string) - XPath expression to query // (string) - File to load // // Returns: (string) - The HTML table definition and header // //----------------------------------------------------------------------------- var m_arrObjs = null; var m_currentUILang = ""; function getString(strPath, strFile) { var locObject = null; var nIndex = 0; var bFound = false; var strRet = ""; locObject = getLocObject(strFile); if ( locObject ) { if(locObject.isLoaded()) { strRet = locObject.getLocString(strPath); } } return strRet; } // User UI Language for example 0409, for default use "" // Resource name // The resouce file name file name // Relative MUI Directory // function InitLocVariable( strUserUILanguage, strResName, strLocXMLFileName, strMUIDir, strDefaultResDir ) { var strReturn; var locObject; var DirObj = new ActiveXObject("Scripting.FileSystemObject"); if( DirObj ) { var folder = DirObj.GetSpecialFolder(0); strDefaultResDir = folder.Path + "\\security\\msscw\\TransformFiles\\"; strMUIDir = folder.Path + "\\security\\msscw\\TransformFiles\\mui\\"; } bFileLoaded = false; locObject = getLocObject(strResName); if ( locObject == null ) { if ( m_arrObjs == null ) { m_arrObjs = new Array(1); nIndex = 0; } else { nIndex = m_arrObjs.length; } m_arrObjs[nIndex] = new localization(); m_arrObjs[nIndex].setName(strResName); // try to load the given UI Language first strTempFile = strDefaultResDir; strTempFile += "\\scwvariables.xml"; strUserUILanguage = GetUserLanguage(strTempFile); if ( strUserUILanguage.length > 0 ) { strTempFile = strMUIDir; strTempFile += strUserUILanguage; strTempFile += "\\"; strTempFile += strLocXMLFileName; bFileLoaded = m_arrObjs[nIndex].loadXML(strTempFile); m_currentUILang = strUserUILanguage; } // Load the default localization file, // if loading the given UI language file failed if ( bFileLoaded == false ) { strTempFile = strDefaultResDir; strTempFile += strLocXMLFileName; bFileLoaded = m_arrObjs[nIndex].loadXML(strTempFile); m_currentUILang = "Default"; } } return m_currentUILang; } //----------------------------------------------------------------------------- // // Method: getNodeTextFromString // // Arguments: (string) strNode - Single node to select // (node) nodParent - Parent node // // Returns: (string) - The value from the attribute or "". // //----------------------------------------------------------------------------- function getNodeTextFromString(strNode, nodParent) { //------------------------------------------------------------------------- // Select the node, or return null if not found //------------------------------------------------------------------------- var pNodeKey; //------------------------------------------------------------------------- // If nodParent undefined or null, then fail //------------------------------------------------------------------------- if(pNodeKey == nodParent || null == nodParent) return null; pNodeKey = nodParent.selectSingleNode(strNode); //------------------------------------------------------------------------- // If not found then return null. //------------------------------------------------------------------------- if(pNodeKey == null) return null; //------------------------------------------------------------------------- // Otherwise return the node text or "" //------------------------------------------------------------------------- return (pNodeKey.text) ? pNodeKey.text : ""; } //----------------------------------------------------------------------------- // // Method: getNodeAttribute // // Arguments: (object) nod - Node to select from // (string) strNode - Single node to select // (string) strAttr - Attribute to retrieve // // Returns: (string) - The value from the attribute or null. // //----------------------------------------------------------------------------- function getNodeAttribute(nod, strNode, strAttr) { //------------------------------------------------------------------------- // Select the node, or return null if not found //------------------------------------------------------------------------- var pNodeKey = nod; if(strNode) { pNodeKey = nod.selectSingleNode(strNode); if(null == pNodeKey) return null; } //------------------------------------------------------------------------- // Return the value or null if not found //------------------------------------------------------------------------- return pNodeKey.getAttribute(strAttr); } //----------------------------------------------------------------------------- // // Method: getNodeTextFromNode // // Arguments: (node) nod - The node to query // // Returns: (string) - The value from the attribute or the empty string. // //----------------------------------------------------------------------------- function getNodeTextFromNode(nod) { //------------------------------------------------------------------------- // If the node passed in is null, then return the empty string //------------------------------------------------------------------------- if(nod == null) return ""; //------------------------------------------------------------------------- // Otherwise return the node text or "" //------------------------------------------------------------------------- return (nod.text) ? nod.text : ""; } //----------------------------------------------------------------------------- // // Method: FormatString // FormatString is a similar function as Win32 FormatMessage // It replaces %1 with the first paramter as so forth // // Arguments: (string) strString- The string that will be formatted // ( Variable argument) // // Returns: (string) - Formatted string // //----------------------------------------------------------------------------- function FormatString(strString) { var numargs = arguments.length; if ( numargs > 1 ) { for ( i = 1 ; i < numargs ; i++) { strParam = "%" + i ; strString = strString.replace(strParam, arguments[i]); } } return strString; } ]]> </msxsl:script> </xsl:stylesheet>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de