Using Barcode maker for Office Word Control to generate, create European Article Number 13 image in Word applications.

www.OnBarcode.com

You have provided a non-locale specific (invariant) file, AppResources.resx, with English (US) captions for the invitation text in it. That s why you see an English interface upon launching the application. Once you click the button to toggle the application into Spanish, you should see the event title and captions translated into the Spanish language, as shown in Figure 12 8. If you examine Figure 12 8 carefully, you will notice a couple of things. First, the title of the application ran off the screen in Spanish a clear mistake on our part for making the font too large and not allowing an extra 40 percent of space inside that title for languages that are more verbose than English. Second, the caption for Cost did not translate into Spanish it should be Costo in Spanish, not Cost. What s going on here The reason for this is that in AppResources.es-ES.resx, there is not entry named EventCost. There is an entry with the name Cost, but that is not the name we are referring to from code. This mistake is a good demonstration of the application s cultural fallback: there was no entry in the Spanish version for EventCost, so the application fell back to the default language (English-US) to represent a given caption the raison d tre of the resource files! Let s go ahead and correct this typo: double-click the AppResources.es-ES.resx file, change the name of the Cost entry to EventCost, and re-run the application. You should see the proper caption, Costo, for the Spanish version of our announcement.

Note The MSDN documentation for internationalizing Windows Phone 7 applications proposes an entirely different approach than the one we ve advocated in our walkthrough in this section. MSDN walkthroughs encourage you to add a separate class to return resources. In our walkthrough, however, we have simplified things a bit and used the ResourceManager class to locate resources within our resource files.

Using Barcode encoder for Microsoft Word Control to generate, create Barcode image in Office Word applications.

www.OnBarcode.com

The main reason our walkthrough differs from the approach advocated by the MSDN documentation is that we are dynamically (i.e., in code) changing the culture of an application. We needed to do this for demonstration purposes, since changing local culture is a bit cumbersome. Dynamic rebinding of elements (to toggle captions between English and Spanish) would be a bit more involved. The addition of a separate class and references to that class, as illustrated in the MSDN documentation, could have also taken away from the main points illustrated during the walkthrough. But we could certainly have used an approach other than the ResourceManager class to accomplish the localization of our application.

In this chapter, you learned how to prepare an application to work in parts of the world other than the United States, including the use of stored culture information and the ToString function to determine how to display data, how to use ISO culture codes to reset an app s CulturalInfo object to the user s preferred language and country environment, and finally how to use resource files to provide translated versions of field names, documentation, and even media. We have discussed specific issues to consider when developing applications for international markets, such as dates, numbers, and currency translations between locales, as well as demonstrated approaches to translate application resources via Visual Studio resource files. In the next chapter, we will take a look at how to persist files and settings on Windows Phone 7 via the use of local storage. We will save images and application settings and show how to load them on demand.

Using Barcode maker for Java Control to generate, create Code 128C image in Java applications.

www.OnBarcode.com

In 3 you learned that Microsoft Azure provides a reliable place to store and access data, but that using it requires Internet access. Sometimes it is more efficient to cache frequently accessed data on the Windows Phone device itself. Isolated storage is a place on a Windows Phone 7 device where an application can save files, configuration information, and other data. Each application is allocated its own portion of the available space, but cannot access file systems used by the operating system itself, a limitation that prevents a rogue application from accessing system data and possibly corrupting it. The amount of storage that can be assigned to any single application depends on the phone s available space, which, unlike iPhones and Android devices, cannot be increased by the use of removable SD cards. With isolated storage, a Windows Phone application can create and maintain a virtual file storage system that can contain virtual folders and files; you will not have direct access to the underlying Windows Phone file system and the isolated storage will provide you with API to work with the file system. All input and output operations can be performed only on the application s isolated storage level. Support for isolated storage on a Windows Phone is provided by the following two namespaces, whose features are depicted by Figure 13 1. Isolated File Storage: System.IO.IsolatedStorage.IsolatedStorageFile allows you to create, use, and remove directories and files in the virtual isolated storage. The files can be added and retrieved through file stream using System.IO.IsolatedStorage.IsolatedFileStream. Isolated file stream can be used to cache images, sounds, and files that are dynamically loaded from the Web. In the first demo, you will learn how use isolated storage to cache an image loaded from the Web. Isolated Local Settings: System.IO.IsolatedStorage.IsolatedStorageSettings provides APIs for storing and working with key-value pairs cached in isolated storage. Use this to store application settings and user specific settings.