Solved

Localization : How to process XML data file?

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

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
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 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.

815 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now