private static void AddMlCaptions(XmlNode page) { MetadataDocumentManagement metaDataDocMgt = MetadataDocumentManagement.Instance; XmlNodeList idList = page.SelectNodes(@".//a:ID", metaDataDocMgt.XmlNamespaceMgt); int destinationID = Convert.ToInt32(page.Attributes["ID"].Value, CultureInfo.InvariantCulture); foreach (XmlNode id in idList) { if (!string.IsNullOrEmpty(id.InnerText)) { try { AddMultiLanguageSupport.PopulateMlStrings(id.ParentNode, destinationID, Convert.ToInt32(id.InnerText, CultureInfo.InvariantCulture)); } catch (Exception ex) { string log = String.Format(CultureInfo.InvariantCulture, Resources.CannotGetMlCaption, "control ", id.InnerText); TransformationLog.GenericLogEntry(log, LogCategory.Warning, destinationID, "Ignore"); TransformationLog.WriteErrorToLogFile(ex, destinationID, LogCategory.Warning); } } } XmlNode pageCaption = page.SelectSingleNode(@"./a:Properties", metaDataDocMgt.XmlNamespaceMgt); if (pageCaption != null) { try { AddMultiLanguageSupport.PopulateMlStrings(pageCaption, destinationID, 0); } catch (Exception ex) { string log = String.Format(CultureInfo.InvariantCulture, Resources.CannotGetMlCaption, "page", string.Empty); TransformationLog.GenericLogEntry(log, LogCategory.Warning, destinationID, "Ignore"); TransformationLog.WriteErrorToLogFile(ex, destinationID, LogCategory.Warning); } } XmlNode code = page.SelectSingleNode(@"./a:Code", metaDataDocMgt.XmlNamespaceMgt); if (code == null) { return; } try { System.Text.RegularExpressions.Regex textVariableExp = new System.Text.RegularExpressions.Regex(@"\@(?<varId>\d+)\s*\:\s*TextConst\s*\'", System.Text.RegularExpressions.RegexOptions.IgnoreCase); if (!textVariableExp.Match(code.InnerText).Success) { return; } string[] codeArr = code.InnerText.Split(new char[] { '\r' }); System.Text.RegularExpressions.Match textVariableMatch; int textVarId; string textVarNewCaption; for (int i = 0; i < codeArr.Length; i++) { textVariableMatch = textVariableExp.Match(codeArr[i]); if (textVariableMatch.Success) { textVarId = Convert.ToInt32(textVariableMatch.Result("${varId}"), CultureInfo.InvariantCulture); textVarNewCaption = AddMultiLanguageSupport.GetCaptionML(destinationID, textVarId, AddMultiLanguageSupport.TranslationType.TextVariable); if (!string.IsNullOrEmpty(textVarNewCaption)) { textVarNewCaption = textVarNewCaption.Replace("'", "''"); codeArr[i] = codeArr[i].Remove(textVariableMatch.Length + textVariableMatch.Index) + textVarNewCaption + "';"; } } } XmlNode codeNode = XmlUtility.CreateXmlElement("Code"); codeNode.AppendChild(XmlUtility.CreateCDataSection(string.Join("\r", codeArr))); code.ParentNode.AppendChild(codeNode); code.ParentNode.RemoveChild(code); } catch (Exception ex) { string log = String.Format(CultureInfo.InvariantCulture, Resources.CannotGetMlCaption, "code", string.Empty); TransformationLog.GenericLogEntry(log, LogCategory.Warning, destinationID, "Ignore"); TransformationLog.WriteErrorToLogFile(ex, destinationID, LogCategory.Warning); } }