15.02.2015 Views

C# 4 and .NET 4

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

summary ❘ 603<br />

Because registering custom languages on the system requires administrative privileges, an application<br />

manifest file is required that specifies the requested execution rights. In the project properties, the manifest<br />

file needs to be set in the Application settings.<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

The newly created culture can now be used like other cultures:<br />

var ci = new CultureInfo("de-AT-ST");<br />

Thread.CurrentThread.CurrentCulture = ci;<br />

Thread.CurrentThread.CurrentUICulture = ci;<br />

code snippet CustomCultures/app.manifest<br />

You can use the culture for formatting <strong>and</strong> also for resources. If you start the Cultures in Action application<br />

that was written earlier in this chapter again, you can see the custom culture as well.<br />

summary<br />

This chapter discussed the globalization <strong>and</strong> localization of .<strong>NET</strong> applications.<br />

In the context of globalization of applications, you learned about using the namespace System<br />

.Globalization to format culture-dependent numbers <strong>and</strong> dates. Furthermore, you learned that sorting<br />

strings by default depends on the culture, <strong>and</strong> you used the invariant culture for a culture-independent sort.<br />

Using the CultureAndRegionInfoBuilder class, you’ve learned how to create a custom culture.<br />

Localization of applications is accomplished by using resources. Resources can be packed into files, satellite<br />

assemblies, or a custom store such as a database. The classes used with localization are in the namespace<br />

System.Resources. For reading resources from other places, such as satellite assemblies or resource files,<br />

you can create a custom resource reader.<br />

You have seen how to localize Windows Forms, WPF, <strong>and</strong> ASP.<strong>NET</strong> applications. Besides all that, you’ve<br />

learned some important vocabulary in different languages.<br />

The next chapter provides information about a completely different topic — transactions. Don’t expect that<br />

transactions will only be useful with databases. In addition to database transactions, the chapter gives you<br />

information on memory-based transactional resources <strong>and</strong> a transactional file system.<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!