Solved

Localization : How to process XML data file?

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
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…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

760 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

24 Experts available now in Live!

Get 1:1 Help Now