O'Reilly logo

Professional ASP.NET 3.5 AJAX by Matt Gibbs, Dan Wahlin, Bill Evjen, Dave Reed

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

13.8. Embedding JavaScript Files

Another option for localizing your JavaScript files is to embed the files directly into the assembly. This approach is a bit different, but it also shows you how to achieve results similar to those just presented.

For this example, create an ASP.NET Web Application Project by selecting File New Project rather than File New Web Site. Instead of creating multiple scripts for each of the languages that you are going to want to work with, you store the language differences in resource files.

First, create a resource file called PageItems.resx. As before, this file contains two items only: Greeting and Question. Enter the same values you entered before. The other file to create is another resource file called PageItems.fi-FI.resx with the same keys as the other file. Figure 13-17 shows how both of these files should appear in the resource editor in Visual Studio 2008.

Once you have the resource files created in your project, the next step is to create a JavaScript file called ScriptLocalization.js that will use either of the resource files that you created. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required