15.02.2015 Views

C# 4 and .NET 4

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

22<br />

localization<br />

WhaT ’ s in This ChaPTer<br />

➤<br />

➤<br />

➤<br />

Using classes that represent cultures <strong>and</strong> regions<br />

Globalization of applications<br />

Localization of applications<br />

NASA ’ s Mars Climate Orbiter was lost on September 23, 1999, at a cost of $125 million, because<br />

one engineering team used metric units, while another one used inches for a key spacecraft operation.<br />

When writing applications for international distribution, different cultures <strong>and</strong> regions must be kept<br />

in mind.<br />

Different cultures have diverging calendars <strong>and</strong> use different number <strong>and</strong> date formats. Also,<br />

sorting strings may lead to various results because the order of A – Z is defi ned differently based<br />

on the culture. To make applications fi t for global markets, you have to globalize <strong>and</strong><br />

localize them.<br />

This chapter covers the globalization <strong>and</strong> localization of .<strong>NET</strong> applications. Globalization is about<br />

internationalizing applications: preparing applications for international markets. With globalization,<br />

the application supports number <strong>and</strong> date formats that vary depending on culture, calendars, <strong>and</strong> so<br />

on. Localization is about translating applications for specifi c cultures. For translations of strings, you<br />

can use resources such .<strong>NET</strong> resources or WPF resource dictionaries.<br />

.<strong>NET</strong> supports the globalization <strong>and</strong> localization of Windows <strong>and</strong> Web applications. To globalize<br />

an application, you can use classes from the namespace System.Globalization ; to localize an<br />

application, you can use resources that are supported by the namespace System.Resources .<br />

namesPaCe sysTem.globalizaTion<br />

The System.Globalization namespace holds all the culture <strong>and</strong> region classes necessary to<br />

support different date formats, different number formats, <strong>and</strong> even different calendars that<br />

are represented in classes such as GregorianCalendar , HebrewCalendar , JapaneseCalendar ,<br />

<strong>and</strong> so on. By using these classes, you can display different representations according to the<br />

user ’ s locale.<br />

www.it-ebooks.info

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

Saved successfully!

Ooh no, something went wrong!