Download presentation
Presentation is loading. Please wait.
Published byHugh Reed Modified over 9 years ago
1
Think Global! Custom Cultures and International Data Matt Ayers Program Manager Windows International Achim Ruopp Program Manager Developer Globalization Microsoft Corporation
2
The Global Software Market Global PC Market in 2010? Source: http://news.com.com/Global+PC+market+to+double+by+2010/2100-1042_3-5490500.html http://news.com.com/Global+PC+market+to+double+by+2010/2100-1042_3-5490500.html 0 200 400 600 800 1000 1200 1400 20042010 Number of PCs in millions Emerging Markets US, Europe, Asia- Pacific Current Install Base
3
The Global Software Market Languages in Florida Source: U.S. Census 2000 (http://quickfacts.census.gov/qfd/states/12000.html) http://quickfacts.census.gov/qfd/states/12000.html English spoken at home 77% Other language sometimes or always spoken at home 23%
4
Reasons to Go Global Increasing market Multinational enterprises Flexibility Web-based applications or distribution International data exchange
5
Internationalization Global user expectations World Ready Localized Text and data are stored in a culture-neutral format Market Specific The User Interface is translated Features are added that are specific to a given culture
6
One Code Base
7
.NET Framework Internationalization Built-in data and functionality for many different cultures Best practices How to exchange data How to customize and extend.Net Framework cultures
8
Quick Quiz In what month does the following day fall? 03/01/2005 a. March? b. January? c. None of the above. d. Not enough info.
9
Formatting Dates and Culture Explorer Achim Ruopp International Program Manager Developer Globalization
10
Culture-Dependent Data API supported Numeric formats Currencies Measurement systems Date/Time formats Time Zones (limited) Calendars Character encoding Capitalization Collation (Sorting) Word breaking (limited) Character output/fonts Character input/ keyboard layouts Bi-Directional layout Multi-lingual UI not API supported Paper sizes Address formats Phone number formats Measurement conversion Exchange rates Taxation Compliance with local laws Business conventions
11
CultureInfo and RegionInfo In the.Net Framework, culture- dependent data is managed by the CultureInfo and RegionInfo classes CultureInfo is used to Format data Load resources Set rules for comparing strings Thread settings CurrentCultureCurrentUICulture
12
Framework Cultures Over 200 cultures will ship in.Net Framework 2.0 Two types of cultures Specific Identified by language and region Neutral Language only Only used for resource loading
13
Handling Different Data Formats in one Code Base
14
Formatting Principles Business Logic/Data Layer 1. Store and transmit the data in culture-invariant format 2.Store as binary data where possible 3. Store additional meta information where necessary User Interface Layer 1. Parse and display data in format the user expects 2. Respect user preferences wherever possible
15
Formatting and Parsing Formatting Standard formatting characters Custom formatting characters Parsing Configurable with styles TryParse – no conversion exceptions ParseExact for date/time values Type Object Culture-appropriateString Formatting Parsing
16
Numbers Numeric Formats Store as binary data type if possible Integer, decimal, floating-point Invariant storage as text Format using CultureInfo.InvariantCulture Use standard format character “R” (reversible) for floating point numbers CultureFormatResult en-USN123,456.78 fr-FRN123 456,78 hi-INN1,23,456.78 "" (invariant) R123456.78
17
Numbers Non-Arabic Numerals Not supported by regular formatting and parsing yet Use new functions in CharUnicodeInfo GetDecimalDigitValueGetNumericValueGetDigitValue Arabic-Indic٤٣٢١1234 Ideographic〧〥75 Number symbols ¼0.25 …
18
Numbers Currencies Preferably store as decimal with meta data CultureDateTime Use 3 rd party service for conversion When storing as text use invariant culture Reversible text floating-point format Currency text format: ¤1,000,000.23 decimal dec = decimal.Parse("$1000000.23", NumberStyles.Currency,CultureInfo.CurrentCulture); System.Console.WriteLine("{0:C}", dec); Output: $1,000,000.23
19
Numbers Measurement Systems
20
Dates and Times Formats Dates – short date format 03/01/2005 in the United States 01/03/2005 in Ireland 01.03.2005 in Russia 2005-03-01 in Korea Times – short time format 2:30 PM in the United States 14:30 in Japan 오전 2:30 in Korea
21
Dates and Times What is a DateTime object? Number of ticks (100 nanosecond units) since January 1, 0001 A.D. (Gregorian calendar) Time Zone – Local vs. UTC v1.x: No information about if DateTime is Local or UTC v2.0: Information intrinsic/definable No possibility yet to convert from one time zone to the other Use UTC for ArithmeticStorageTransmission Daylight saving time
22
Dates and Times DateTime Formatting/Parsing Controlled by DateTimeFormatInfoCalendar Gregorian calendar is default for DateTime Invariant text formats R or r (RFC1123) Thu, 09 Jun 2005 20:30:00 GMT s (ISO 8601) 2005-06-09T13:30:00 yyyy-MM-ddTHH:mm:sszzzzz (XML) 2005-06-09T13:30:00-07:00
23
Sorting and Comparing Text Achim Ruopp International Program Manager Developer Globalization
24
Text Representation Unicode (UTF-16) is data type for text “Parsing” text Deal with strings wherever possible Character processing - text elements Combining characters é = e + é = e + Unicode surrogate pairs Combination of two 16-bit values to identify character Improved support for processing text elements in v2.0 Unicode Standard Normalization available in v2.0
25
Text Sorting and Comparison Comparison just a special case of sorting For culture-appropriate comparison use StringComparison.CurrentCulture For culture-agnostic comparison use StringComparison.OrdinalStringComparison.OrdinalIgnoreCase ToUpperInvariant for upper casing More performant Less likely to change over time
26
Verifying globalization using FxCop Achim Ruopp International Program Manager Developer Globalization
27
Verification using FxCop FxCop – a static code analysis tool Downloadable from GotDotNet website Visual Studio Team Developer: full version Contains rules for checking GlobalizationLocalizability
28
Extending the Framework
29
Over 6 billion people on the planet, even 200 cultures just isn’t enough You can expand cultures through User overrides Custom cultures Windows Data Derived cultures
30
User Overrides Per-user setting affecting the current default culture. Set using regional options in Windows Limited set of customizable fields Only in effect for CurrentCulture w/ UseUserOverride = True Available in all versions of the.Net Framework
31
Custom cultures Are installed for all users on a machine Allow you to set more fields than user overrides Can either replace a culture that ships with.Net Framework or add to the set of Framework cultures
32
Creating a custom culture The old way – override CultureInfo Cumbersome Only works for a specific application Difficult to maintain Some APIs clone before using
33
Creating a custom culture The new way – use the CultureAndRegionInfoBuilder (CARIB) Portable Works for all users and all applications Creates a CultureInfo object that is the same as those that ship with the Framework
34
Supplemental Cultures Use supplemental cultures to expand the set of cultures available in the.Net framework Some limitations Single custom LCID No custom collations or calendars Display name is same as native name
35
Create A New Culture Spanish in the U.S.
36
// Set the native name and DateTimeFormat information to Spanish carib.CultureNativeName = “Español (Estados-Unidos)”; carib.GregorianDateTimeFormat = ciES.DateTimeFormat; // Keep the United States’ time pattern carib.GregorianDateTimeFormat.LongTimePattern = ciUS.DateTimeFormat.LongTimePattern; [...]
37
Create A New Culture Spanish in the U.S. // Deploy the Culture on this machine carib.Register(); // Instantiate a new CultureInfo from our new data CultureInfo ci = new CultureInfo("es-US");
38
Create the Supplemental Culture es-US Matt Ayers Program Manager Windows International
39
Replacement Cultures
40
Important Note! If an admin replaces a culture, applications can not access the Microsoft definitions Use CultureInfo.CultureTypes property to determine if a CultureInfo represents a replacement culture If ((ci.CultureTypes & CultureTypes. ReplacementCultures) != 0) {…}
41
Windows Data Derived Cultures Used when a culture does not exist in the.Net Framework but is available as a Windows Locale For example: zu-ZA, cy-GB, mt-MT The.Net Framework uses data from the Windows Locale to create a CultureInfo
42
Interoperability & Migration Non-Microsoft Platforms Use CultureAndRegionInfoBuilder.Save to generate LDML files Use CultureAndRegionInfoBuilder.Load to read LDML files Note that most non-Microsoft LDML files will require some tweaking before calling Register()
43
Conclusion To ship a global-ready application, you must use data-formatting tailored to your target market With some planning, you can make a global-ready application from the beginning and save time and money down the road Net Framework 2.0 allows users to expand the set of available formats
44
Resources Resource 1: Microsoft GlobalDev WebsiteGlobalDev Website Resource 2: Developing International Software 2 Dr. International (available at the TechEd store) Resource 3: Globalization & Localization in Visual Studio Globalization & Localization in Visual Studio Resource 4: Send mail to Dr. InternationalDr. International Resource 5: Internationalization newsgroupInternationalization newsgroup Resource 6: Globalization Handbook for the Microsoft.Net Platform Bill Hall Resource 7: Blogs Sorting it All Out Tales from the Crossroads Sorting it All Out Tales from the Crossroads
45
Resources Tech-Ed 2005 International Break-out Sessions Title Code ASP.NET 2.0: Going Global Gets Easier! New Localization Features in ASP.NET 2.0 WEB326 Deploying Office 2003 in a Multilingual Environment DSK345 Deploying Windows XP in a Multilingual Environment DSK350 Databases for the World: Best Practices for Search in Multilingual Data Sets Using SQL Server Collation for Sorting and Indexing DBA319 Microsoft Business Solutions–Axapta: A Truly Global Business Application BAP347 Supporting East Asian Languages in Global Exchange Deployments MSG369.NET Framework: Think Global! Custom Cultures and International Data DEV323 Databases for the World: Designing Multilingual Databases Using SQL Server 2005 DAT290 Planning a Global Release: Many countries, Many Languages, One Process ARC303
46
Resources Tech-Ed 2005 International Cabana Talks Dr. International’s Clinic Booth in the Community Cabana International Experts available all week longTitle Code Custom Cultures in Whidbey: An In-Depth Discussion DEVC21 Advanced Localization Architecture DEVC19 Windows XP MUI: Keeping it Localized & Secure DSKC07 Meet the Speakers From ARC303: Planning a Global Release ARCC04
47
Your Feedback is Important! Please Fill Out a Survey for This Session on CommNet
48
© 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
49
Resources (URL format) Resource 1: http://www.microsoft.com/globaldevhttp://www.microsoft.com/globaldev Resource 2: Developing International Software 2 Dr. International Resource 3: http://msdn.microsoft.com/library/default.asp?url=/library/en- us/vbcon/html/vxoriGlobalizationLocalizationNamespaces.asp http://msdn.microsoft.com/library/default.asp?url=/library/en- us/vbcon/html/vxoriGlobalizationLocalizationNamespaces.asp Resource 4:mailto:drintl@microsoft.commailto:drintl@microsoft.com Resource 5: news:microsoft.public.dotnet.internationalization news:microsoft.public.dotnet.internationalization Resource 6: Globalization Handbook for the Microsoft.Net Platform Bill Hall Resource 7: http://blogs.msdn.com/michkap http://blogs.msdn.com/achimrhttp://blogs.msdn.com/michkap http://blogs.msdn.com/achimr
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.