You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi I would like to thank you for this library, it is great help in MVC application :)
But I found a several bugs MvcSiteMapProvider when I would like to use resource files for mvcSiteMapNode.
For Title & Description properties / attributes it works only with Explicit localization ($resources: ...).
When you try to use Implicit localization (use with resourceKey attribute), you will always get empty value or better say, it will return value specified in mvcSiteMapNode attribute in the XML sitemap file, but not from Resource file (in format ResourceKey.Attribute).
I checked the code, and the problem is that MvcSiteMapProvider.SiteMap class has invalid value in ResourceKey property, that returns SiteMapCacheKey (that is generated by ISiteMapCacheKeyGenerator.GenerateKey()) value that returns a string in format "sitemap://hostname/", but it should return Resource file Class Key (that is resource filename without resx extension). Without it, it will never return valid value from any Resource file.
public virtual string ResourceKey
{
get
{
return this.siteMapSettings.SiteMapCacheKey;
}
set
{
}
}
For custom attributes in mvcSiteMapNode it doesn't work for any type of localization.
This time the problem is in MvcSiteMapProvider.Collections.Specialized.AttributeDictionary.Add() method, where is no reading from Resource file implemented at all (for Explicit & Implicit localization). It just parse string via MvcSiteMapProvider.Globalization.IExplicitResourceKeyParser.HandleResourceAttribute() method to determine if Explicit localization is used or not.
public void Add(string key, object value, bool throwIfReservedKey)
{
if (this.reservedAttributeNameProvider.IsRegularAttribute(key))
{
if (value.GetType().Equals(typeof(string)))
value = localizationService.ExtractExplicitResourceKey(key, value.ToString());
if (!this.ContainsKey(key))
base.Add(key, value);
else
base[key] = value;
}
else if (throwIfReservedKey)
{
throw new ReservedKeyException(string.Format(Resources.Messages.AttributeKeyReserved, this.siteMapNodeKey, key, value));
}
}
Hopefully you would have time to fix it in next releases, so we can use the library with proper localization features. :)
Thanks for help
Franky
The text was updated successfully, but these errors were encountered:
@FrantisekBodnar - have you received any updates on this issue?
I've been trying to get this working with the westwind db localization provider, and the resourceSet is always sitemap://hostname/.
is the only workaround to use explicit localization?
Hi I would like to thank you for this library, it is great help in MVC application :)
But I found a several bugs MvcSiteMapProvider when I would like to use resource files for mvcSiteMapNode.
For Title & Description properties / attributes it works only with Explicit localization ($resources: ...).
When you try to use Implicit localization (use with resourceKey attribute), you will always get empty value or better say, it will return value specified in mvcSiteMapNode attribute in the XML sitemap file, but not from Resource file (in format ResourceKey.Attribute).
I checked the code, and the problem is that MvcSiteMapProvider.SiteMap class has invalid value in ResourceKey property, that returns SiteMapCacheKey (that is generated by ISiteMapCacheKeyGenerator.GenerateKey()) value that returns a string in format "sitemap://hostname/", but it should return Resource file Class Key (that is resource filename without resx extension). Without it, it will never return valid value from any Resource file.
For custom attributes in mvcSiteMapNode it doesn't work for any type of localization.
This time the problem is in MvcSiteMapProvider.Collections.Specialized.AttributeDictionary.Add() method, where is no reading from Resource file implemented at all (for Explicit & Implicit localization). It just parse string via MvcSiteMapProvider.Globalization.IExplicitResourceKeyParser.HandleResourceAttribute() method to determine if Explicit localization is used or not.
Hopefully you would have time to fix it in next releases, so we can use the library with proper localization features. :)
Thanks for help
Franky
The text was updated successfully, but these errors were encountered: