ASP.NET Resource Files
When you work with ASP.NET, resources are handled by resource files. A resource file is an XML-based file that has a .resx extension. You can have Visual Studio help you construct this file. Resource files provide a set of items that are utilized by a specified culture. In your ASP.NET applications, you store resource files as either local resources or global resources. The following sections describe how to use each type of resource.
Making Use of Local Resources
You might be surprised how easily you can build an ASP.NET page so that it can be localized into other languages. In fact, the only thing you need to do is build the ASP.NET page as you normally would and then use some built-in capabilities from Visual Studio to convert the page to a format that enables you to plug in other languages easily.
To see this in action, build an ASP.NET empty web application called ProVB_Localization. Next, add a new web form called a Default.aspx page. Note that a few simple controls have been added. This page will be referred to later in this chapter as the “ASP.NET page code block.” Keep in mind that the downloaded code will not match the initial code snippet shown here because this chapter modifies this code to support multiple languages (code file: Default.aspx):
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="ProVB_Localization._Default" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> ...
Get Professional Visual Basic 2012 and .NET 4.5 Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.