Solved

Localization : How to process XML data file?

Posted on 2014-11-05
4
170 Views
Last Modified: 2014-11-14
Based on the article ASP Internationalization, I have created a separate resource file for each locale. I can process all the views and built in code. But how should I process data specified in XML file?

The @Resources.Home doesn't work
<?xml version="1.0" encoding="utf-8" ?>
<items>
  <item Text="@Resources.Home" NavigateUrl="~/Home">
    <item Text="@Resources.Dashboard" NavigateUrl="~/Routing/Dashboard"/>
  </item>

</items>

Open in new window

0
Comment
Question by:ran_deep
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 40425042
What is that XML file for?
0
 
LVL 2

Accepted Solution

by:
ran_deep earned 0 total points
ID: 40426506
Its actually binding to my menu control.
I came out with a solution to have a xml file for each locale. And then bind the path with a locale helper class.

        public static string GetPath()
        {
            var culture = Thread.CurrentThread.CurrentUICulture;
            string letters = culture.TwoLetterISOLanguageName;
            if (String.IsNullOrWhiteSpace(letters))
                return String.Empty;
            return HttpContext.Current.Server.MapPath(String.Format("~/App_Data/TopMenu.{0}.xml", letters));

        }

Open in new window


E.g. TopMenu.en.xml, TopMenu.es.xml

.BindToXML(CultureHelper.GetPath(), "/items/*").GetHtml()
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 40426617
Since you can't use @Resource, you would need to find a code solution.  One possible solution would be to use a marker that you can replace with text.

The problem is determining the better approach to replace the resource name with the value (i.e. @Resources.Home with the value from the selected resource file).
0
 
LVL 2

Author Closing Comment

by:ran_deep
ID: 40442246
This is my final answer
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foolproof security solutions has become one of the key necessities of every e-commerce or Internet banking website. If you too own an online shopping site then its vital for you to equip your web portal with customer security features that can allow…
Developer tools in browsers have been around for a while, yet they are still heavily underused by developers. Developers still fix html or CSS then refresh page to see effect, or they put alert or debugger in JavaScript and then try again and again …
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question