How to use implicit localization with MVCSiteMap?
Asked Answered
S

2

6

I'm trying to use implict localization with MVCSiteMap but it's not working.

Here's my sample Web.Sitemap:

<?xml version="1.0" encoding="utf-8" ?>

<mvcSiteMap xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-2.0" enableLocalization="true">

<mvcSiteMapNode title="Home" controller="Home" action="Index" changeFrequency="Always" updatePriority="Normal">

    <mvcSiteMapNode resourceKey="Products" title="Products" controller="Products" action="Index">
        <mvcSiteMapNode title="Edit" controller="Products" action="Edit" />
    </mvcSiteMapNode>

    <mvcSiteMapNode title="Categories" controller="Categories" action="Index" />
    <mvcSiteMapNode title="Suppliers" controller="Suppliers" action="Index" />

</mvcSiteMapNode>
</mvcSiteMap>

I have resourceKey="Products" in the above sitemap and a corresponding Products.title in Web.sitemap.resx file, inside App_GlobalResources folder. Followed these instructions: http://msdn.microsoft.com/en-us/library/ms178427(VS.80).aspx

What I am missing here?

Edit

This has been implemented in the changeset 52831.

Stork answered 23/10, 2010 at 19:9 Comment(2)
Why down voted? Can someone explain it to me? What I asked wrong here?Stork
+1 because this question does not deserve a down vote...Tent
S
6

This was addressed in the latest version (at the time of this writing, version 2.2.1) of MvcSitemapProvider thanks to the project's owner, Maarten Balliauw!

MvcSitemapProvider's implicit localization is almost identical as the default SitemapProvider (see How to: Localize Site-Map Data). The ONLY difference is that instead setting <siteMap enableLocalization="true"> in the sitemap file itself, you must set this in the Web.Config file (as described here).

Stork answered 8/11, 2010 at 2:12 Comment(0)
G
2

You need to access the title of the menu item from the resource file in your MvcSiteMapNode

<mvcSiteMapNode title="$resources:MenuLocaliSations,Dashboard" controller="Dashboard" action="Index" changeFrequency="Always" updatePriority="Normal">
Gorgerin answered 24/10, 2010 at 11:55 Comment(1)
This is explicit localization, not what I want. I want to use the "resourceKey" attribute...Stork

© 2022 - 2024 — McMap. All rights reserved.