diff options
author | Rob Mensching <rob@firegiant.com> | 2019-03-01 07:33:20 -0800 |
---|---|---|
committer | Rob Mensching <rob@robmensching.com> | 2019-03-01 07:57:55 -0800 |
commit | a4f5a5a042c00254607fbecdf132a2e2a91a1bdd (patch) | |
tree | 9edb392b55a902259dcaaa3cecd2fa359c3797f2 /src/WixToolset.Core | |
parent | 138e65b99c215eb8277ad60c16cf7ceb0faff842 (diff) | |
download | wix-a4f5a5a042c00254607fbecdf132a2e2a91a1bdd.tar.gz wix-a4f5a5a042c00254607fbecdf132a2e2a91a1bdd.tar.bz2 wix-a4f5a5a042c00254607fbecdf132a2e2a91a1bdd.zip |
Rename ILocalizer to ILocalizationParser
Diffstat (limited to 'src/WixToolset.Core')
-rw-r--r-- | src/WixToolset.Core/CommandLine/BuildCommand.cs | 4 | ||||
-rw-r--r-- | src/WixToolset.Core/ILocalizationParser.cs (renamed from src/WixToolset.Core/ILocalizer.cs) | 6 | ||||
-rw-r--r-- | src/WixToolset.Core/LocalizationParser.cs (renamed from src/WixToolset.Core/Localizer.cs) | 34 | ||||
-rw-r--r-- | src/WixToolset.Core/WixToolsetServiceProvider.cs | 2 |
4 files changed, 23 insertions, 23 deletions
diff --git a/src/WixToolset.Core/CommandLine/BuildCommand.cs b/src/WixToolset.Core/CommandLine/BuildCommand.cs index 6b5d01a0..fbc88f08 100644 --- a/src/WixToolset.Core/CommandLine/BuildCommand.cs +++ b/src/WixToolset.Core/CommandLine/BuildCommand.cs | |||
@@ -350,7 +350,7 @@ namespace WixToolset.Core.CommandLine | |||
350 | private IEnumerable<Localization> LoadLocalizationFiles(IEnumerable<string> locFiles, IDictionary<string, string> preprocessorVariables) | 350 | private IEnumerable<Localization> LoadLocalizationFiles(IEnumerable<string> locFiles, IDictionary<string, string> preprocessorVariables) |
351 | { | 351 | { |
352 | var localizations = new List<Localization>(); | 352 | var localizations = new List<Localization>(); |
353 | var localizer = this.ServiceProvider.GetService<ILocalizer>(); | 353 | var parser = this.ServiceProvider.GetService<ILocalizationParser>(); |
354 | 354 | ||
355 | foreach (var loc in locFiles) | 355 | foreach (var loc in locFiles) |
356 | { | 356 | { |
@@ -361,7 +361,7 @@ namespace WixToolset.Core.CommandLine | |||
361 | continue; | 361 | continue; |
362 | } | 362 | } |
363 | 363 | ||
364 | var localization = localizer.ParseLocalizationFile(document); | 364 | var localization = parser.ParseLocalization(document); |
365 | localizations.Add(localization); | 365 | localizations.Add(localization); |
366 | } | 366 | } |
367 | 367 | ||
diff --git a/src/WixToolset.Core/ILocalizer.cs b/src/WixToolset.Core/ILocalizationParser.cs index ba39dd5c..0e70aa0e 100644 --- a/src/WixToolset.Core/ILocalizer.cs +++ b/src/WixToolset.Core/ILocalizationParser.cs | |||
@@ -8,20 +8,20 @@ namespace WixToolset.Core | |||
8 | /// <summary> | 8 | /// <summary> |
9 | /// Parses localization source files. | 9 | /// Parses localization source files. |
10 | /// </summary> | 10 | /// </summary> |
11 | public interface ILocalizer | 11 | public interface ILocalizationParser |
12 | { | 12 | { |
13 | /// <summary> | 13 | /// <summary> |
14 | /// Loads a localization file from a path on disk. | 14 | /// Loads a localization file from a path on disk. |
15 | /// </summary> | 15 | /// </summary> |
16 | /// <param name="path">Path to localization file saved on disk.</param> | 16 | /// <param name="path">Path to localization file saved on disk.</param> |
17 | /// <returns>Returns the loaded localization file.</returns> | 17 | /// <returns>Returns the loaded localization file.</returns> |
18 | Localization ParseLocalizationFile(string path); | 18 | Localization ParseLocalization(string path); |
19 | 19 | ||
20 | /// <summary> | 20 | /// <summary> |
21 | /// Loads a localization file from memory. | 21 | /// Loads a localization file from memory. |
22 | /// </summary> | 22 | /// </summary> |
23 | /// <param name="document">Document to parse as localization file.</param> | 23 | /// <param name="document">Document to parse as localization file.</param> |
24 | /// <returns>Returns the loaded localization file.</returns> | 24 | /// <returns>Returns the loaded localization file.</returns> |
25 | Localization ParseLocalizationFile(XDocument document); | 25 | Localization ParseLocalization(XDocument document); |
26 | } | 26 | } |
27 | } | 27 | } |
diff --git a/src/WixToolset.Core/Localizer.cs b/src/WixToolset.Core/LocalizationParser.cs index 94fa6ff7..f7f86a54 100644 --- a/src/WixToolset.Core/Localizer.cs +++ b/src/WixToolset.Core/LocalizationParser.cs | |||
@@ -11,33 +11,33 @@ namespace WixToolset.Core | |||
11 | using WixToolset.Extensibility; | 11 | using WixToolset.Extensibility; |
12 | using WixToolset.Extensibility.Services; | 12 | using WixToolset.Extensibility.Services; |
13 | 13 | ||
14 | internal class Localizer : ILocalizer | 14 | internal class LocalizationParser : ILocalizationParser |
15 | { | 15 | { |
16 | public static readonly XNamespace WxlNamespace = "http://wixtoolset.org/schemas/v4/wxl"; | 16 | public static readonly XNamespace WxlNamespace = "http://wixtoolset.org/schemas/v4/wxl"; |
17 | private static string XmlElementName = "WixLocalization"; | 17 | private static string XmlElementName = "WixLocalization"; |
18 | 18 | ||
19 | internal Localizer(IServiceProvider serviceProvider) | 19 | internal LocalizationParser(IServiceProvider serviceProvider) |
20 | { | 20 | { |
21 | this.Messaging = serviceProvider.GetService<IMessaging>(); | 21 | this.Messaging = serviceProvider.GetService<IMessaging>(); |
22 | } | 22 | } |
23 | 23 | ||
24 | private IMessaging Messaging { get; } | 24 | private IMessaging Messaging { get; } |
25 | 25 | ||
26 | public Localization ParseLocalizationFile(string path) | 26 | public Localization ParseLocalization(string path) |
27 | { | 27 | { |
28 | var document = XDocument.Load(path); | 28 | var document = XDocument.Load(path); |
29 | return this.ParseLocalizationFile(document); | 29 | return this.ParseLocalization(document); |
30 | } | 30 | } |
31 | 31 | ||
32 | public Localization ParseLocalizationFile(XDocument document) | 32 | public Localization ParseLocalization(XDocument document) |
33 | { | 33 | { |
34 | XElement root = document.Root; | 34 | XElement root = document.Root; |
35 | Localization localization = null; | 35 | Localization localization = null; |
36 | 36 | ||
37 | SourceLineNumber sourceLineNumbers = SourceLineNumber.CreateFromXObject(root); | 37 | SourceLineNumber sourceLineNumbers = SourceLineNumber.CreateFromXObject(root); |
38 | if (Localizer.XmlElementName == root.Name.LocalName) | 38 | if (LocalizationParser.XmlElementName == root.Name.LocalName) |
39 | { | 39 | { |
40 | if (Localizer.WxlNamespace == root.Name.Namespace) | 40 | if (LocalizationParser.WxlNamespace == root.Name.Namespace) |
41 | { | 41 | { |
42 | localization = ParseWixLocalizationElement(this.Messaging, root); | 42 | localization = ParseWixLocalizationElement(this.Messaging, root); |
43 | } | 43 | } |
@@ -45,17 +45,17 @@ namespace WixToolset.Core | |||
45 | { | 45 | { |
46 | if (null == root.Name.Namespace) | 46 | if (null == root.Name.Namespace) |
47 | { | 47 | { |
48 | this.Messaging.Write(ErrorMessages.InvalidWixXmlNamespace(sourceLineNumbers, Localizer.XmlElementName, Localizer.WxlNamespace.NamespaceName)); | 48 | this.Messaging.Write(ErrorMessages.InvalidWixXmlNamespace(sourceLineNumbers, LocalizationParser.XmlElementName, LocalizationParser.WxlNamespace.NamespaceName)); |
49 | } | 49 | } |
50 | else | 50 | else |
51 | { | 51 | { |
52 | this.Messaging.Write(ErrorMessages.InvalidWixXmlNamespace(sourceLineNumbers, Localizer.XmlElementName, root.Name.LocalName, Localizer.WxlNamespace.NamespaceName)); | 52 | this.Messaging.Write(ErrorMessages.InvalidWixXmlNamespace(sourceLineNumbers, LocalizationParser.XmlElementName, root.Name.LocalName, LocalizationParser.WxlNamespace.NamespaceName)); |
53 | } | 53 | } |
54 | } | 54 | } |
55 | } | 55 | } |
56 | else | 56 | else |
57 | { | 57 | { |
58 | this.Messaging.Write(ErrorMessages.InvalidDocumentElement(sourceLineNumbers, root.Name.LocalName, "localization", Localizer.XmlElementName)); | 58 | this.Messaging.Write(ErrorMessages.InvalidDocumentElement(sourceLineNumbers, root.Name.LocalName, "localization", LocalizationParser.XmlElementName)); |
59 | } | 59 | } |
60 | 60 | ||
61 | return localization; | 61 | return localization; |
@@ -90,7 +90,7 @@ namespace WixToolset.Core | |||
90 | 90 | ||
91 | foreach (XAttribute attrib in node.Attributes()) | 91 | foreach (XAttribute attrib in node.Attributes()) |
92 | { | 92 | { |
93 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || Localizer.WxlNamespace == attrib.Name.Namespace) | 93 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || LocalizationParser.WxlNamespace == attrib.Name.Namespace) |
94 | { | 94 | { |
95 | switch (attrib.Name.LocalName) | 95 | switch (attrib.Name.LocalName) |
96 | { | 96 | { |
@@ -119,16 +119,16 @@ namespace WixToolset.Core | |||
119 | 119 | ||
120 | foreach (XElement child in node.Elements()) | 120 | foreach (XElement child in node.Elements()) |
121 | { | 121 | { |
122 | if (Localizer.WxlNamespace == child.Name.Namespace) | 122 | if (LocalizationParser.WxlNamespace == child.Name.Namespace) |
123 | { | 123 | { |
124 | switch (child.Name.LocalName) | 124 | switch (child.Name.LocalName) |
125 | { | 125 | { |
126 | case "String": | 126 | case "String": |
127 | Localizer.ParseString(messaging, child, variables); | 127 | LocalizationParser.ParseString(messaging, child, variables); |
128 | break; | 128 | break; |
129 | 129 | ||
130 | case "UI": | 130 | case "UI": |
131 | Localizer.ParseUI(messaging, child, localizedControls); | 131 | LocalizationParser.ParseUI(messaging, child, localizedControls); |
132 | break; | 132 | break; |
133 | 133 | ||
134 | default: | 134 | default: |
@@ -157,7 +157,7 @@ namespace WixToolset.Core | |||
157 | 157 | ||
158 | foreach (XAttribute attrib in node.Attributes()) | 158 | foreach (XAttribute attrib in node.Attributes()) |
159 | { | 159 | { |
160 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || Localizer.WxlNamespace == attrib.Name.Namespace) | 160 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || LocalizationParser.WxlNamespace == attrib.Name.Namespace) |
161 | { | 161 | { |
162 | switch (attrib.Name.LocalName) | 162 | switch (attrib.Name.LocalName) |
163 | { | 163 | { |
@@ -202,7 +202,7 @@ namespace WixToolset.Core | |||
202 | Value = value, | 202 | Value = value, |
203 | }; | 203 | }; |
204 | 204 | ||
205 | Localizer.AddWixVariable(messaging, variables, variable); | 205 | LocalizationParser.AddWixVariable(messaging, variables, variable); |
206 | } | 206 | } |
207 | } | 207 | } |
208 | 208 | ||
@@ -225,7 +225,7 @@ namespace WixToolset.Core | |||
225 | 225 | ||
226 | foreach (XAttribute attrib in node.Attributes()) | 226 | foreach (XAttribute attrib in node.Attributes()) |
227 | { | 227 | { |
228 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || Localizer.WxlNamespace == attrib.Name.Namespace) | 228 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || LocalizationParser.WxlNamespace == attrib.Name.Namespace) |
229 | { | 229 | { |
230 | switch (attrib.Name.LocalName) | 230 | switch (attrib.Name.LocalName) |
231 | { | 231 | { |
diff --git a/src/WixToolset.Core/WixToolsetServiceProvider.cs b/src/WixToolset.Core/WixToolsetServiceProvider.cs index f7c23cd7..49d4b3fe 100644 --- a/src/WixToolset.Core/WixToolsetServiceProvider.cs +++ b/src/WixToolset.Core/WixToolsetServiceProvider.cs | |||
@@ -49,7 +49,7 @@ namespace WixToolset.Core | |||
49 | this.AddService<ILinker>((provider, singletons) => new Linker(provider)); | 49 | this.AddService<ILinker>((provider, singletons) => new Linker(provider)); |
50 | this.AddService<IResolver>((provider, singletons) => new Resolver(provider)); | 50 | this.AddService<IResolver>((provider, singletons) => new Resolver(provider)); |
51 | 51 | ||
52 | this.AddService<ILocalizer>((provider, singletons) => new Localizer(provider)); | 52 | this.AddService<ILocalizationParser>((provider, singletons) => new LocalizationParser(provider)); |
53 | this.AddService<IVariableResolver>((provider, singletons) => new VariableResolver(provider)); | 53 | this.AddService<IVariableResolver>((provider, singletons) => new VariableResolver(provider)); |
54 | } | 54 | } |
55 | 55 | ||