Microsoft .NET Development Platform Internationalization - PowerPoint PPT Presentation

1 / 40
About This Presentation
Title:

Microsoft .NET Development Platform Internationalization

Description:

Collections. Resources. Reflection. Net. IO. Threading. Text ... Web Forms designer fully supports flow-layout of ASP .NET pages .RESX resource format ... – PowerPoint PPT presentation

Number of Views:66
Avg rating:3.0/5.0
Slides: 41
Provided by: downloadM
Category:

less

Transcript and Presenter's Notes

Title: Microsoft .NET Development Platform Internationalization


1
Microsoft .NET Development Platform
Internationalization
  • Garrett McGowan
  • International Program Manager
  • Microsoft Corporation

2
.NET InternationalizationOverview
  • The .NET Framework provides a rich set of object
    class libraries, integrated into its Common
    Language Runtime. This framework enables
    developers to program against a single object
    model that works across multiple programming
    languages, operating systems, and
    cultures/locales.
  • Visual Studio .NET builds on this foundation,
    providing a unified development environment for
    both Windows and .NET Framework. Its solid
    Unicode and international support allows for the
    rapid development of globally-aware Windows and
    Web applications.

3
.NET InternationalizationAgenda
  • .NET Framework
  • Globalization namespace
  • Culture-sensitive classes
  • Resource model
  • ASP .NET
  • International support
  • Localization options
  • Visual Studio .NET
  • Unicode support
  • Windows and Web Form international support
  • Windows and Web Form localization
  • References

4
.NET FrameworkBackground
  • Microsoft's platform for building, deploying,
    operating and integrating XML Web services
  • Rich XML, standard protocols, stateless
  • Cross-language development
  • Common language runtime
  • Common type system for all languages
  • Rich runtime environment
  • Rich class libraries (.NET Framework)
  • Base class libraries, ADO.NET and XML
  • Windows Forms for rich, Win32 applications
  • Web application platform ASP.NET
  • Easier to deploy, run, maintain applications
  • For components, versioning, availability

5
.NET FrameworkGlobalization
  • Unicode internally
  • UTF-8 and UTF-16 encoding classes
  • Surrogates Combining characters support
  • Character type information
  • Carries NLS classes, sorting tables
  • Consistent results on Windows XP, Windows 2000,
    Windows NT 4, Windows Millennium, Windows 98
  • Limitations on down-level Unicode support
  • Underlying operating system limitations
  • File I/O (Windows code pages)
  • Some Win9x controls are ANSI-only

6
.NET FrameworkNamespaces
System.Web
System.WinForms
Services
UI
Design
ComponentModel
Description
HtmlControls
Discovery
WebControls
Protocols
System.Drawing
Caching
Security
Drawing2D
Printing
Text
Configuration
SessionState
Imaging
System.Data
System.Xml
ADO
SQL
XSLT
Serialization
Design
SQLTypes
XPath
System
Collections
IO
Security
Runtime
InteropServices
Configuration
Net
ServiceProcess
Remoting
Diagnostics
Reflection
Text
Serialization
Globalization
Resources
Threading
7
.NET FrameworkSystem.Globalization
  • Includes classes for functionality such as
  • Culture-aware string comparison
  • AABC vs. ABCC (ordinal codepoint values)
  • Coté vs. Côte (culture dependent)
  • Date Time formatting
  • yy/mm/dd vs. dd/mm/yy
  • Numeric formatting
  • 12,000.00 vs. 12.000,00
  • Calendars
  • Gregorian and non-Gregorian
  • Starting point CultureInfo class

8
.NET FrameworkSystem.Globalization.CultureInfo
  • Cultural preferences provider
  • Two roles
  • CurrentCulture
  • Date and number formatting
  • String comparison and casing
  • CurrentUICulture
  • Resource selection for user interface
  • Can be controlled on a per thread basis
  • CultureInfo.CreateSpecificCulture
  • Optional mapping from neutral to specific

9
.NET FrameworkSystem.Globalization.CultureInfo
(continued)
  • RFC 1766 derived hierarchy
  • Invariant culture
  • Culture-invariant default
  • Neutral culture
  • Based on language
  • Resource only
  • CurrentUICulture only
  • Specific culture
  • Based on language region
  • Resource Formatting specifics
  • CurrentCulture CurrentUICulture

10
.NET FrameworkCultureInfo.InvariantCulture
  • For UI, culture-sensitive formatting preferred
  • For wire-transfer or data storage, a stable,
    culture-neutral format may be preferred
  • ,.
  • dd MMMM yyyy HHmmss GMT
  • international currency symbol
  • Use CultureInfo.InvariantCulture

11
.NET FrameworkSetting Cultures Explicitly
  • CurrentUICulture
  • Thread.CurrentThread.CurrentUICulture new
    CultureInfo(ja)
  • CurrentCulture
  • Thread.CurrentThread.CurrentCulture new
    CultureInfo(ja-JP)
  • CreateSpecificCulture
  • Thread.CurrentThread.CurrentCulture
    CultureInfo.CreateSpecificCulture(Request.UserLang
    uages(0))
  • Within an individual API that takes a culture
  • Str DateTime.Now.ToString(CultureInfo)

12
.NET FrameworkCulture-aware classes
  • Any API that takes a culture or IFormatProvider
  • Culture-sensitive by default
  • Examples (see Appendix for more info)
  • System.Globalization.CompareInfo
  • System.Globalization.StringInfo
  • System.Globalization.Calendar
  • System.Resources
  • System.DateTime
  • System.String

13
.NET FrameworkSystem.Globalization.CultureInfo
Demo
14
.NET FrameworkSystem.Resources namespace
  • ResourceManager
  • Provides access to culture-correct resources at
    runtime
  • ResourceWriter
  • Writes resources to an output stream or file
  • ResourceReader
  • Reads resources name-value pairs from resources
    files and streams
  • ResourceSet
  • Stores all resources localized for a particular
    culture

15
.NET FrameworkResource generation process
  • .resx file
  • XML-based
  • Describes resources
  • .resources file
  • Binary compiled file
  • Satellite .resources.dll
  • Embedded .resources file(s)

.resx file
.resources file
.resources.dll file
16
.NET FrameworkNaming conventions
  • Naming pattern conventions
  • .resources files
  • ltmyprojectgt.ltxx-XXgt.resources
  • Satellite assemblies
  • ltmyprojectgt.resources.dll
  • Directory locations for satellites
  • A subdirectory per culture
  • either neutral or specific cultures can be used
  • Myproject.dll
  • \de\myproject.resources.dll (neutral)
  • \de-DE\myproject.resources.dll (specific)

17
.NET FrameworkLoading resources
  • Loads requested resources based on
    Thread.CurrentThread.CurrentUICulture
  • Creating a Resource Manager
  • RM constructor indicates which file to load
    resource from
  • Alternatives
  • Load from a loose .resources file
  • Load from this assembly
  • Load from another assembly
  • Load from a custom resource format, using own
    resource manager (e.g. a database)
  • See .NET SDK, Samples and Tutorials, ASP.NET
    QuickStarts, and How Do I samples

18
.NET FrameworkResource fallback
19
.NET InternationalizationAgenda
  • .NET Framework
  • Globalization namespace
  • Culture-sensitive classes
  • Resource model
  • ASP .NET
  • International support
  • Localization options
  • Visual Studio .NET
  • Unicode support
  • Windows and Web Form international support
  • Windows and Web Form localization
  • References

20
ASP.NETInternational support
  • Delivers improved support for international
    application development
  • Can leverage .NET Framework base classes
  • System.Globalization
  • System.Text (encodings)
  • System.Resources
  • Can separate resources from source code
  • Unicode-enabled
  • More options for specifying encoding

21
ASP .NETCulture and encoding
  • Programmatically
  • Thread.CurrentThread.CurrentCulture .
  • Page directive
  • lt_at_Page ResponseEncodingutf-8 gt
  • Configuration file (web.config)
  • Per application or per machine
  • ltglobalization
  • culturede-DE
  • fileEncodingutf-8 /gt
  • Most specific setting has precedence
  • Programmatic overrides page directive
  • Page directive overrides configuration file

22
ASP .NETLocalization recommendations
  • Resources separated from source
  • Use Resource Manager to load resources
  • Resources could be in
  • Loose .resources files
  • Satellites below each main assembly
  • A separate (parallel) main assembly with
    satellites below it
  • One .resources file or satellite per language
  • Slightly different ResourceManager constructors
    for each case

23
ASP.NETLocalization recommendations (continued)
  • Advantages
  • Can deploy additional languages incrementally,
    without redeploying core code
  • Lower maintenance costs, as there is one central
    app, not many parallel versions
  • Disadvantages
  • More files
  • Loose .resources can have locking issue.
  • No locking issue for satellites or parallel main
    assembly with satellites
  • Shadow-copying done for exes and dlls (main
    assemblies and satellites)
  • Samples ASP.NET Quickstarts, Localization section

24
.NET InternationalizationAgenda
  • Microsoft .NET Framework
  • Globalization namespace
  • Culture-sensitive classes
  • Resource model
  • ASP .NET
  • International support
  • Localization options
  • Microsoft Visual Studio .NET
  • Unicode support
  • Windows and Web Form international support
  • Windows and Web Form localization
  • References

25
Visual Studio .NETUnicode support - Development
Environment
  • Development environment is Unicode-enabled, with
    some exceptions
  • resource editor for Win32 resources
  • some debugger dialogs
  • some wizards
  • Source code editor
  • allows the editing of all scripts including
    complex scripts
  • uses font linking to render characters outside
    the current font

26
Visual Studio .NETUnicode support - Compilers
  • Visual Basic .NET, Visual C? .NET and Visual
    JScript .NET
  • All use Unicode-encoded source code (UTF-16) as
    input
  • Automatic conversion from a range of different
    character encodings
  • Byte-order-mark at the start of the file for
    detecting UTF-forms
  • /codepage compiler option for Visual C? .NET and
    Visual JScript .NET
  • Managed Extensions for C
  • Exception uses Windows codepages (configurable)
    and ASCII identifiers

27
Visual Studio .NETInternational support for
Windows Forms
  • Windows Forms are Unicode forms on all Windows
    platforms (some small limitations with legacy
    controls on Windows 98 and Windows ME)
  • Windows Forms have a font linking mechanism
  • Windows Forms support bi-directional layout and
    complex scripts rendering
  • Culture-aware controls such as DateTime picker
    and Calendar

28
Visual Studio .NETWindows Forms localization
VS .NET Editor
  • Windows Forms provide localization support
  • Every form has a Localizable property
  • Localizable property set to True
  • Project system automatically keeps track of
    different language versions of a form
  • Builds the different language forms into
    satellite assemblies
  • The resource format used is an XML format (RESX)
    that gets compiled into a binary format
  • Any XML localization tool can be used
  • .NET Development Platform SDK contains a
    standalone visual editing tool WinRes
  • 3rd parties are enabling their localization tools
    to deal with the new resource formats (Alchemy,
    Lionbridge)

29
Visual Studio .NETWeb Forms localization VS
.NET Editor
  • Web Forms designer fully supports flow-layout of
    ASP .NET pages
  • .RESX resource format
  • can be used for string resources
  • is supported by the project system in the
    development environment

30
.NET InternationalizationAgenda
  • .NET Framework
  • Globalization namespace
  • Culture-sensitive classes
  • Resource model
  • ASP .NET
  • International support
  • Localization options
  • Visual Studio .NET
  • Unicode support
  • Windows and Web Form international support
  • Web Services and Deployment international support
  • Windows and Web Form localization
  • References

31
References.NET Framework
  • Documentation
  • .NET Framework SDK
  • Developing World-Ready Applications
  • Tutorials
  • Samples
  • Visual Studio
  • Visual Studio.NET\Visual Basic and
    VisualC\Globalizing and Localizing\Walkthroughs
  • General info on .NET Framework
  • http//msdn.microsoft.com/net
  • http//www.GotDotNet.com
  • General info on globalization
  • http//www.microsoft.com/globaldev

32
ReferencesVisual Studio .NET
  • http//msdn.microsoft.com/vstudio/
  • Visual Studio documentation
  • Visual Studio .NET\Visual Basic and Visual
    C\Globalizing and Localizing
  • Microsoft Layer for Unicode contained in the
    July 2001 Platform SDK http//www.microsoft.com/ms
    download/platformsdk/setuplauncher.asp

33
ReferencesXML UDDI
  • W3C XML Protocol Activity
  • http//www.w3.org/2000/xp/
  • UDDI (Universal Description, Discovery and
    Integration)
  • http//www.uddi.org/

34
Appendix.NET Framework Calendar classes
  • Gregorian Calendar
  • Hebrew Calendar
  • Hijiri Calendar
  • Japanese Calendar
  • Julian Calendar
  • Korean Calendar
  • Taiwan Calendar
  • Thai Buddhist Calendar
  • Base Calendar class (derive custom calendars)

35
Appendix .NET Framework DateTime
DateTimeFormatInfo classes
  • DateTime
  • Provides methods that enable culture-sensitive
    operations on a DateTime.
  • Use the DateTimeFormatInfo Class to format and
    display a DateTime based on culture.
  • DateTimeFormatInfo
  • Defines how DateTime values are formatted and
    displayed, depending on the culture.

36
Appendix.NET Framework NumberFormatInfo class
  • NumberFormatInfo
  • Defines how currency, decimal separator and other
    numeric symbols are formatted and displayed,
    based on culture

37
Appendix.NET Framework CompareInfo class
  • CompareInfo
  • Provides a set of methods that can be used to
    perfomr culture-sensitive string comparisons
  • The CultureInfo class has a CompareInfo property
    that is an instance of the CompareInfo class
  • The String.Compare method uses the information in
    the CultureInfo.CompareInfo property to compare
    strings

38
AppendixVS .NET New intl support for native C
applications
  • MFC and ATL libraries support the new Microsoft
    Layer for Unicode (MSLU) for Windows 98 and
    Windows ME
  • MFC application wizard provides templates for 9
    different languages
  • ATL Server supports the creation of Unicode ISAPI
    Web applications and provides locale support in
    conjunction with the C runtime

39
Appendix VS .NET International support for XML
Web Services
  • Based on standard efforts - SOAP and UDDI
  • SOAP (Simple Object Access Protocol)
  • based on XML and HTTP
  • globalized data types
  • UDDI (Universal Description, Discovery and
    Integration)
  • based on SOAP
  • version 2.0 introduced improvements for i18n
  • Visual Studio .NET contains support to easily
    produce, consume, and debug XML Web Services

40
AppendixVS .NET International support for
Deployment
  • Visual Studio Deployment projects allow you to
    create deployment projects in nine languages,
    including
  • English
  • German
  • French
  • Italian
  • Spanish
  • Japanese
  • Korean
  • Chinese (simplified and traditional)
Write a Comment
User Comments (0)
About PowerShow.com