/// <summary> /// Parses the WixLocalization element. /// </summary> /// <param name="node">Element to parse.</param> private static Localization ParseWixLocalizationElement(IMessaging messaging, XElement node) { int codepage = -1; string culture = null; SourceLineNumber sourceLineNumbers = SourceLineNumber.CreateFromXObject(node); foreach (XAttribute attrib in node.Attributes()) { if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || Localizer.WxlNamespace == attrib.Name.Namespace) { switch (attrib.Name.LocalName) { case "Codepage": codepage = Common.GetValidCodePage(attrib.Value, true, false, sourceLineNumbers); break; case "Culture": culture = attrib.Value; break; case "Language": // do nothing; @Language is used for locutil which can't convert Culture to lcid break; default: Common.UnexpectedAttribute(messaging, sourceLineNumbers, attrib); break; } } else { Common.UnexpectedAttribute(messaging, sourceLineNumbers, attrib); } } Dictionary <string, BindVariable> variables = new Dictionary <string, BindVariable>(); Dictionary <string, LocalizedControl> localizedControls = new Dictionary <string, LocalizedControl>(); foreach (XElement child in node.Elements()) { if (Localizer.WxlNamespace == child.Name.Namespace) { switch (child.Name.LocalName) { case "String": Localizer.ParseString(messaging, child, variables); break; case "UI": Localizer.ParseUI(messaging, child, localizedControls); break; default: messaging.Write(ErrorMessages.UnexpectedElement(sourceLineNumbers, node.Name.ToString(), child.Name.ToString())); break; } } else { messaging.Write(ErrorMessages.UnsupportedExtensionElement(sourceLineNumbers, node.Name.ToString(), child.Name.ToString())); } } return(messaging.EncounteredError ? null : new Localization(codepage, culture, variables, localizedControls)); }