From c5190ae74ab8fe13609362efce88fa4b8cc24f34 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 30 Dec 2017 17:09:15 -0800 Subject: Fix resolution of localizations that are embedded in intermediates --- src/WixToolset.Core/Localizer.cs | 63 +--------------------------------------- 1 file changed, 1 insertion(+), 62 deletions(-) (limited to 'src/WixToolset.Core/Localizer.cs') diff --git a/src/WixToolset.Core/Localizer.cs b/src/WixToolset.Core/Localizer.cs index 2e7b19b6..38d8864e 100644 --- a/src/WixToolset.Core/Localizer.cs +++ b/src/WixToolset.Core/Localizer.cs @@ -14,72 +14,11 @@ namespace WixToolset.Core /// /// Parses localization files and localizes database values. /// - public sealed class Localizer : ILocalizer + public sealed class Localizer { public static readonly XNamespace WxlNamespace = "http://wixtoolset.org/schemas/v4/wxl"; private static string XmlElementName = "WixLocalization"; - private Dictionary variables; - private Dictionary localizedControls; - - /// - /// Instantiate a new Localizer. - /// - public Localizer(IMessaging messaging, IEnumerable localizations) - { - this.Codepage = -1; - this.variables = new Dictionary(); - this.localizedControls = new Dictionary(); - - foreach (var localization in localizations) - { - if (-1 == this.Codepage) - { - this.Codepage = localization.Codepage; - } - - foreach (var variable in localization.Variables) - { - Localizer.AddWixVariable(messaging, this.variables, variable); - } - - foreach (KeyValuePair localizedControl in localization.LocalizedControls) - { - if (!this.localizedControls.ContainsKey(localizedControl.Key)) - { - this.localizedControls.Add(localizedControl.Key, localizedControl.Value); - } - } - } - } - - /// - /// Gets the codepage. - /// - /// The codepage. - public int Codepage { get; } - - /// - /// Get a localized data value. - /// - /// The name of the localization variable. - /// The localized data value or null if it wasn't found. - public string GetLocalizedValue(string id) - { - return this.variables.TryGetValue(id, out var wixVariableRow) ? wixVariableRow.Value : null; - } - - /// - /// Get a localized control. - /// - /// The optional id of the control's dialog. - /// The id of the control. - /// The localized control or null if it wasn't found. - public LocalizedControl GetLocalizedControl(string dialog, string control) - { - return this.localizedControls.TryGetValue(LocalizedControl.GetKey(dialog, control), out var localizedControl) ? localizedControl : null; - } - /// /// Loads a localization file from a path on disk. /// -- cgit v1.2.3-55-g6feb