Skip to content

Commit b06a02c

Browse files
committed
Add test for Localization variable with multiple dots '.' within it.
Modify Common.TryParseWixVariable to only look for subsequent dots in the bind variables, the others (wix/loc) will just be considered as names that include dots. Also fixed up typo of 'identifier'. Signed-off-by: Bevan Weiss <bevan.weiss@gmail.com>
1 parent 1011c56 commit b06a02c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/wix/WixToolset.Core/Common.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public static string GenerateIdentifier(string prefix, params string[] args)
299299
/// <summary>
300300
/// Return an identifier based on provided file or directory name
301301
/// </summary>
302-
/// <param name="name">File/directory name to generate identifer from</param>
302+
/// <param name="name">File/directory name to generate identifier from</param>
303303
/// <returns>A version of the name that is a legal identifier.</returns>
304304
internal static string GetIdentifierFromName(string name)
305305
{
@@ -767,7 +767,7 @@ internal static bool TryParseWixVariable(string value, int start, out ParsedWixV
767767
var end = equalsDefaultValue == -1 ? closeParen : equalsDefaultValue;
768768
var secondDot = value.IndexOf('.', firstDot + 1, end - firstDot);
769769

770-
if (secondDot == -1)
770+
if ( (secondDot == -1) || (ns != "bind") )
771771
{
772772
name = value.Substring(firstDot + 1, end - firstDot - 1);
773773
}

src/wix/test/WixToolsetTest.Core/VariableResolverFixture.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ public void CanRecursivelyResolveVariables()
2323
{ "ProductName", new BindVariable() { Id = "ProductName", Value = "Localized Product Name" } },
2424
{ "ProductNameEdition", new BindVariable() { Id = "ProductNameEdition", Value = "!(loc.ProductName) Enterprise Edition" } },
2525
{ "ProductNameEditionVersion", new BindVariable() { Id = "ProductNameEditionVersion", Value = "!(loc.ProductNameEdition) v1.2.3" } },
26+
{ "ProductNameEditionVersion.WithDot", new BindVariable() { Id = "ProductNameEditionVersion.WithDot", Value = "Test of localization variable with dot" } },
27+
{ "ProductNameEditionVersion.WithDotTest", new BindVariable() { Id = "ProductNameEditionVersion.WithDotTest", Value = "!(loc.ProductNameEditionVersion.WithDot) v1.2.3" } },
2628
};
2729

2830
var localization = new Localization(0, null, "x-none", variables, new Dictionary<string, LocalizedControl>());
@@ -45,6 +47,10 @@ public void CanRecursivelyResolveVariables()
4547
WixAssert.StringEqual("Welcome to Localized Product Name Enterprise Edition v1.2.3", result.Value);
4648
Assert.True(result.UpdatedValue);
4749

50+
result = variableResolver.ResolveVariables(null, "Welcome to !(loc.ProductNameEditionVersion.WithDotTest)");
51+
WixAssert.StringEqual("Welcome to Test of localization variable with dot v1.2.3", result.Value);
52+
Assert.True(result.UpdatedValue);
53+
4854
result = variableResolver.ResolveVariables(null, "Welcome to !(bind.property.ProductVersion)");
4955
WixAssert.StringEqual("Welcome to !(bind.property.ProductVersion)", result.Value);
5056
Assert.False(result.UpdatedValue);

0 commit comments

Comments
 (0)