From 39c7e2bb0399802e65a3025c4a73db211e730479 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 1 Oct 2017 14:25:33 -0700 Subject: Add support for BindPaths and building .wixlibs --- src/WixToolset.Core/Localizer.cs | 53 ++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 29 deletions(-) (limited to 'src/WixToolset.Core/Localizer.cs') diff --git a/src/WixToolset.Core/Localizer.cs b/src/WixToolset.Core/Localizer.cs index 3c299896..63ead24a 100644 --- a/src/WixToolset.Core/Localizer.cs +++ b/src/WixToolset.Core/Localizer.cs @@ -23,11 +23,32 @@ namespace WixToolset /// /// Instantiate a new Localizer. /// - public Localizer() + public Localizer(IEnumerable localizations) { this.Codepage = -1; - this.variables = new Dictionary(); + this.variables = new Dictionary(); this.localizedControls = new Dictionary(); + + foreach (var localization in localizations) + { + if (-1 == this.Codepage) + { + this.Codepage = localization.Codepage; + } + + foreach (WixVariableRow wixVariableRow in localization.Variables) + { + Localizer.AddWixVariable(this.variables, wixVariableRow); + } + + foreach (KeyValuePair localizedControl in localization.LocalizedControls) + { + if (!this.localizedControls.ContainsKey(localizedControl.Key)) + { + this.localizedControls.Add(localizedControl.Key, localizedControl.Value); + } + } + } } /// @@ -75,31 +96,6 @@ namespace WixToolset return localization; } - /// - /// Add a localization file. - /// - /// The localization file to add. - public void AddLocalization(Localization localization) - { - if (-1 == this.Codepage) - { - this.Codepage = localization.Codepage; - } - - foreach (WixVariableRow wixVariableRow in localization.Variables) - { - Localizer.AddWixVariable(this.variables, wixVariableRow); - } - - foreach (KeyValuePair localizedControl in localization.LocalizedControls) - { - if (!this.localizedControls.ContainsKey(localizedControl.Key)) - { - this.localizedControls.Add(localizedControl.Key, localizedControl.Value); - } - } - } - /// /// Get a localized data value. /// @@ -107,8 +103,7 @@ namespace WixToolset /// The localized data value or null if it wasn't found. public string GetLocalizedValue(string id) { - WixVariableRow wixVariableRow; - return this.variables.TryGetValue(id, out wixVariableRow) ? wixVariableRow.Value : null; + return this.variables.TryGetValue(id, out var wixVariableRow) ? wixVariableRow.Value : null; } /// -- cgit v1.2.3-55-g6feb