diff options
Diffstat (limited to '')
-rw-r--r-- | src/WixToolset.Core/LocalizationParser.cs (renamed from src/WixToolset.Core/Localizer.cs) | 34 |
1 files changed, 17 insertions, 17 deletions
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 | { |