From a32c298797ce38b0f65c5202edddbbfa71bc3725 Mon Sep 17 00:00:00 2001 From: Shad Storhaug Date: Fri, 1 Aug 2014 12:05:44 +0700 Subject: [PATCH] Fixes #339, localization not working on custom attributes. --- .../Globalization/ExplicitResourceKeyParser.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/Globalization/ExplicitResourceKeyParser.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/Globalization/ExplicitResourceKeyParser.cs index 87407402..631fd8da 100644 --- a/src/MvcSiteMapProvider/MvcSiteMapProvider/Globalization/ExplicitResourceKeyParser.cs +++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/Globalization/ExplicitResourceKeyParser.cs @@ -23,11 +23,9 @@ public void HandleResourceAttribute(string attributeName, ref string value, ref if (((trimmedText.Length > 10)) && trimmedText.ToLower(CultureInfo.InvariantCulture).StartsWith("$resources:", StringComparison.Ordinal)) { resourceString = trimmedText.Substring(11); - string resourceLocation; - string resourceName; var index = resourceString.IndexOf(','); - resourceLocation = resourceString.Substring(0, index); - resourceName = resourceString.Substring(index + 1); + string resourceLocation = resourceString.Substring(0, index); + string resourceName = resourceString.Substring(index + 1); var length = resourceName.IndexOf(','); if (length != -1) { @@ -36,7 +34,9 @@ public void HandleResourceAttribute(string attributeName, ref string value, ref } else { - value = null; + // Fixes #339, return string datatype (rather than null) so custom + // attributes can still be identified as string vs another datatype. + value = string.Empty; } if (explicitResourceKeys == null) {