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
Solved

Localization : How to process XML data file?

Posted on 2014-11-05
4
169 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
  • 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
It’s a strangely common occurrence that when you send someone their login details for a system, they can’t get in. This article will help you understand why it happens, and what you can do about it.
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.
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

860 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