How to implement localization in web.sitemap
Asked Answered
B

4

8

Can you explain how to implement localization in web.sitemap please?

Bio answered 5/3, 2009 at 12:1 Comment(0)
B
5

Use a global resource file.

App_GlobalResources\Web.sitemap.resx

Then use keys in the web.sitemap like;

<siteMapNode url="somepage.aspx" title="Name"  resourceKey="PageName"/>
Bracket answered 5/3, 2009 at 12:7 Comment(4)
but in the resource what should i do,,means i have 5 resource file and i am using one resource file(cart.resx) for menuBio
You need to create a resx for the web.sitemap. Copy one from somewhere else and then put in "PageName" as the resource key and then put in the new value. Please upvote and mark as answer :)Bracket
means,, i didnt get u,,all breadcrumbs are coming in any one of 5 resource files ,,in resource file(.resx) what i have to do for title(breadcrumb)Bio
@Deadaccount is not totally correct. Within your resx file, you need to use a key like `PageName.Title' to set the Title of the node.Chlorothiazide
R
5

If you have global resources you can use it like this

<siteMapNode url="~/Default.aspx" Title="$resources:SiteMapLocalizations,HomePageTitle"></siteMapNode>

Where SiteMapLocalizations: is the resource Name HomePageTitle: thee resource Key

Reference: http://msdn.microsoft.com/en-us/library/ms178427.aspx

Richert answered 26/7, 2010 at 10:22 Comment(1)
And a note: do not use this construct when your resources are compiled into an assembly (like with WDProj or MSDeploy). It won't pick them up. In that case, use @DeadAccounts solution with resourceKey.Chlorothiazide
C
2

It's worthy to notice that you also need to set enableLocalization="true" at siteMap tag. Otherwise it will not work.

Commie answered 21/11, 2016 at 18:18 Comment(0)
C
0

1) Add an enableLocalization='true' attribute to the <siteMap> root node in the Web.sitemap file.

2) Add a unique resourceKey attribute to each <siteMapNode> node in the Web.sitemap file.

3) Create a new Web.sitemap.resx resources file in the GlobalResources directory.

4) Open the new Web.sitemap.resx file. Add each <siteMapNode> resourceKey attribute you created in Step 2 to the resources list under the Name column, followed by .Description to set the localized description, and .Title to set the localized title. The displayed text then goes into the Value column.

Note that Visual Studio will flag each resource entry with a red exclamation saying that it's an invalid identifier - ignore the warning.

For example, if your <siteMapNode> had a resourceKey of "Example", the localized Description tag would be Example.Description and the localized Title tag would be Example.Title

That should do it. You can then provide translations for other languages by duplicating the resx file and renaming the copy to fit the new culture.

If it doesn't work, make sure the new resource file is in the GlobalResources directory, not LocalResources. Also make sure OutputCache is disabled.

Chomp answered 12/7, 2019 at 18:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.