0

I am in middle of refactoring old asp.net code (some of it is from frontpage era) and am wanting to move all the references to the "$Resources:resources, ” from aspx pages to Page_Render in code behind file of each page.

Main purpose of this excersie is to support localization, as we have grown to other international regions. There are about 70 odd aspx pages and each page contains 5 to 10) labels, literals etc with most of them don't have ID tag. :)

How should I go about doing this massive task productively and if there are any tools/tips people have for me. I have already spent 5 days on it and it is not even half done :(

K

1 Answer 1

0

I believe you can replace your labels like this:

<span>Some Static Content</span>

to ASP.NET code like this:

<%= Localise("SomeStaticContent") %>

And on your page you can add this:

public string Localise(string key) {
    return HttpUtility.HtmlEncode( ResourceManager.GetString(key) ); // or whatever
}

This should be one of the easiest approaches.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.