How to localize your sitemap in a easy way.

Topics: Developer Forum, Localization Forum
Jul 11, 2007 at 11:09 PM
Hello,

just thought I could post this trick to localize your sitemap. It's easy to implement and doesn't require any change to core.

First of all, open your web.sitemap file inside your app_data folder. Change this line:

<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">

into

<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" enableLocalization="true">

Now create a resource file for localizations in App_GlobalResources. Say you name it SitemapLocalization.resx and also add italian version SitemapLocalization.it.resx. Add a new string in both files, for example "Homepage" as key, like this:

SitemapLocalizations.resx : Homepage (Key) -> Homepage (value)
SitemapLocalizations.it.resx: Homepage (Key) -> Pagina principale (value)

Close both files and run your portal. Browse to "Pages and Navigations" page. Select Homepage and type in Navigation box:

$resources:SitemapLocalization,Homepage,Home

Save page data. Now you should be able to localize your sitemap.

General format is:
$resources:ClassName,KeyName,DefaultValue

ClassName -> filename (for ex. SitemapLocalizations)
KeyName -> key inside previous file (for ex. Homepage)
DefaultValue -> well, try a wild guess ;-)

Hope this helps. Used with MLHTMLContent section I posted a while ago, this makes localizing your portal very easy.