Multilingual Web Pages with ASP and XML
By Ken Cox
By design, the World Wide Web crosses international boundaries and supports multiple languages. To make your site or intranet application available to the largest audience, your pages need to be localized. Localization is the process of translating content such as text and graphics into other languages while accounting for the cultural differences of the target audience. In this article, you'll learn how to:
- Create one template version of a Web page using Active Server Pages (ASP)
- Build the XML file containing the language resources
- Use the XPath syntax and MSXML3 parser to locate the desired content within an XML document
- Dynamically insert language strings into the HTML stream
What you need:
IIS 4 or PWS ASP MSXML V3 (Web release)
|
|
Our project is a simple HTML form for submitting name and address information. To see what we're building, look at Figure 1, the Spanish version of the form in Netscape Navigator. With the techniques shown here you'll see how you can add languages to your site simply by updating one XML file.
Well-formed HTML and XML Documents
The first step is to create the Web page using your favorite editor. I found it easiest to design the page using static placeholder text (such as "First name") on each row. After the XML is ready, replace the static text with variables. As you see in the downloadable code, I named my HTML file xmltrans.asp.