Presentation is loading. Please wait.

Presentation is loading. Please wait.

Developing International Applications with Visual Studio 2005

Similar presentations


Presentation on theme: "Developing International Applications with Visual Studio 2005"— Presentation transcript:

1 Developing International Applications with Visual Studio 2005
11/23/2018 7:01 AM Developing International Applications with Visual Studio 2005 Marin Millar Globalization Manager Microsoft © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

2 Overview Goals Introduce new globalization and localization features in .NET Framework 2.0 and Visual Studio 2005 Topics .NET Runtime Windows Forms ASP .NET 26th Internationalization and Unicode Conference 2

3 .NET Framework 2.0 Custom Cultures Supplementary Character Support IDN
Normalization New Calendars Resources 26th Internationalization and Unicode Conference 3

4 Developing International Applications with Visual Studio
11/23/2018 7:01 AM Custom Cultures Custom culture examples Replacement Cultures Replacing or adding customizations to existing cultures Ex: ja-JP-MyCompany or en-US-24hr Supplemental Cultures New combination of language and location es-US for Spanish in the US Tagalog in Guam 26th Internationalization and Unicode Conference 4 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

5 Custom Culture in 1.0/1.1 Set CurrentCulture and CurrentUIculture to different values Example: es-US (Spanish-United States) set CurrentThread.CurrentUICulture to es (for resources) set CurrentThread.CurrentCulture to en-US (for formatting) Disadvantages Date text is English, unless DTFI is overridden Override CultureInfo to create custom culture Existing custom culture sample on GotDotNet Devs have to create their own implementations. Solution is not supported in the CultureInfo mechanism i.e., not included in cultures list for CultureInfo.GetAllCultures App domain limitation: custom culture must be recreated across app domains 26th Internationalization and Unicode Conference 5

6 Developing International Applications with Visual Studio
11/23/2018 7:01 AM Custom Cultures in 2.0 Goal: Easily define new cultures Easily deploy new cultures Custom cultures are equivalent to pre-defined cultures Return all cultures, including custom cultures CultureInfo.GetCultures(CultureTypes.AllAvailableCultures) Return custom cultures only CultureInfo.GetCultures(CultureTypes.UserCustomCultures) Standardized solution No need to make separate DTFI updates change date display language No limitations across app domains 26th Internationalization and Unicode Conference 6 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

7 Developing International Applications with Visual Studio
11/23/2018 7:01 AM Custom cultures Limitations String name “en-US-MyCompany” is unique; LCID is not One LCID per custom culture LCID assigned to user-default locale Changing the user-default locale to custom culture: String name changes LCID does not change No UI designer for custom cultures Cannot use custom classes for CultureInfo classes such as CompareInfo, TextInfo, Calendar Can customize cultures to use existing classes 26th Internationalization and Unicode Conference 7 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

8 Developing International Applications with Visual Studio
11/23/2018 7:01 AM Personalize A Culture CultureAndRegionInfoBuilder carib = new CultureAndRegionInfoBuilder(new CultureInfo("en-US", false), null, “en”, “US”, “MyCompany"); carib.DateTimeFormat.LongTimePattern = “HH:mm:ss”;    carib.Register(); CultureInfo ci = new CultureInfo("en-US-MyCompany”); //-OR- Save and register a file: carib.Save("c:\\temp\\myculture.xml"); CultureAndRegionInfoBuilder.Register(“c:\\tmp\\myculture.xml”); 26th Internationalization and Unicode Conference 8 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

9 Developing International Applications with Visual Studio
11/23/2018 7:01 AM Create A New Culture CultureInfo ciES = new CultureInfo("es-ES"); CultureInfo ciUS = new CultureInfo("en-US"); CultureAndRegionInfoBuilder carib = new CultureAndRegionInfoBuilder(ciEs, null, "es", "US"); carib.NumberFormat.CurrencySymbol = ciUS.NumberFormat.CurrencySymbol; carib.DateTimeFormat = ciUS.DateTimeFormat; carib.DateTimeFormat.DayNames = ciES.DateTimeFormat.DayNames; carib.DateTimeFormat.MonthNames = ciES.DateTimeFormat.MonthNames; carib.DateTimeFormat.AbbreviatedDayNames = ciES.DateTimeFormat.AbbreviatedDayNames; carib.DateTimeFormat.AbbreviatedMonthNames = ciES.DateTimeFormat.AbbreviatedMonthNames ; carib.Register(); CultureInfo ci = new CultureInfo("es-US"); 26th Internationalization and Unicode Conference 9 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

10 Developing International Applications with Visual Studio
11/23/2018 7:01 AM Developing a Custom Culture Marin Millar Globalization Manager Developer Division 26th Internationalization and Unicode Conference 10 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

11 International Domain Names
Developing International Applications with Visual Studio 11/23/2018 7:01 AM International Domain Names New Standard (IDN) Enables non-ASCII domain names  IDN Mapping class containing IDN conversion APIs System.Globalization.IdnMapping GetAscii and GetUnicode provide host name conversion between native Unicode and Punycode Limitations This support does not cover IRIs Standard is not yet finalized Not yet implemented in System.Net URI/IRI classes 26th Internationalization and Unicode Conference 11 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

12 Developing International Applications with Visual Studio
11/23/2018 7:01 AM International Domain Names Marin Millar Globalization Manager Developer Division 26th Internationalization and Unicode Conference 12 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

13 Developing International Applications with Visual Studio
11/23/2018 7:01 AM Normalization Support 4 normalization forms (C,D,KC,KD) Composition, shortest form Decomposition, longest form Normalize strings public string Normalize(System.Text.NormalizationForm normalizationForm) Verify normalization or normalization form public bool IsNormalized(System.Text.NormalizationForm normalizationForm) Implementation conforms to sample in Unicode Tech Report 15: 26th Internationalization and Unicode Conference 13 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

14 Supplementary Characters
Developing International Applications with Visual Studio 11/23/2018 7:01 AM Supplementary Characters v. 1.0, 1.1 Methods on StringInfo to parse characters and walk text elements v. 2.0 Additional methods on StringInfo to find surrogate pairs in substrings public string SubstringByTextElements(int startingTextElement, int lengthInTextElements) New property to determine length of strings containing surrogate pairs public int LengthInTextElements [get] Char.IsLetter recognizes surrogate pairs New methods in System.Char class to detect high and low surrogate codepoints New methods to convert between Unicode and UTF-32 Use Unicode or UTF-8 for better performance 26th Internationalization and Unicode Conference 14 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

15 Developing International Applications with Visual Studio
11/23/2018 7:01 AM Supplementary Characters Marin Millar Globalization Manager Developer Division 26th Internationalization and Unicode Conference 15 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

16 Developing International Applications with Visual Studio
11/23/2018 7:01 AM New Calendars Enable date conversions between regional calendars New algorithms include: UmAlQura calendar Implementation of Hijiri calendar Jalaali calendar Calander used in Farsi communities East Asian Lunisolar calendars PRC Taiwan Japan Korea 26th Internationalization and Unicode Conference 16 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

17 Resource Model Additions
Developing International Applications with Visual Studio 11/23/2018 7:01 AM Resource Model Additions Strongly Typed Resources What are they? Creates classes containing read-only properties for resources Benefits: Provides Intellisense on resource identifiers No need to create a ResourceManager Eliminates mismatches between code and resource identifiers No need to cast objects to other types Additional fallback resource location v. 1.0/1.1 – ResourceManager only loaded fallback resources from the main assembly v. 2.0 – Adds ability to build fallback resources in a satellite assembly public NeutralResourcesLanguageAttribute(string cultureName, System.Resources.UltimateResourceFallbackLocation location) 26th Internationalization and Unicode Conference 17 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

18 Resource Performance Suggestions
Developing International Applications with Visual Studio 11/23/2018 7:01 AM Resource Performance Suggestions Put satellite assemblies in the GAC Satellite assemblies in the GAC are FAR more performant Use ResourceManager.GetStream for image resources Returns an unmanaged memory stream for images Far more performant than GetObject public System.IO.UnmanagedMemoryStream GetStream(string name) Use Culture-Neutral Images Loading images is expensive Using culture-neutral images can save a lot on performance Use NeutralLanguageResources Attribute Specifies the language of the default resources Eliminates probing for the neutral language resources 26th Internationalization and Unicode Conference 18 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

19 Developing International Applications with Visual Studio
11/23/2018 7:01 AM Strongly Typed Resources Marin Millar Globalization Manager Developer Division 26th Internationalization and Unicode Conference 19 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

20 Windows Forms Localization 1.0
Each form has a localizable property Create single .resx file per form Edit source/localized .resx files in the Windows Forms designer or XML editor Images serialized into .resx file Pulled each localizable property from the .resx file Built satellite assemblies directly in VS Setup projects available in 9 languages 26th Internationalization and Unicode Conference 20

21 Windows Forms Localization 2.0
Localizable property remains the same One .resx file per form Images Linked into resx files rather than serialized Default to app wide .resx file Edit source/localized resources in resource designer New layout functionality reduces resizing during localization Deploy Click Once projects in any language 26th Internationalization and Unicode Conference 21

22 Localize Without Resizing
Developing International Applications with Visual Studio 11/23/2018 7:01 AM Localize Without Resizing 1.0/1.1 Use docking and anchoring properties 2.0 Two new controls Use TableLayoutPanel for: Resizing a group of controls proportionally Dynamically generating UI with customizable fields Creating a fixed size UI while still allowing localization Use FlowLayoutPanel for: Creating a series of horizontal controls which may wrap vertically but aren’t proportional to each other Mechanism for “bumping” controls relative to other controls 26th Internationalization and Unicode Conference 22 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

23 Developing International Applications with Visual Studio
11/23/2018 7:01 AM Using Layout Controls Marin Millar Globalization Manager Developer Division 26th Internationalization and Unicode Conference 23 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

24 RightToLeft Languages
Developing International Applications with Visual Studio 11/23/2018 7:01 AM RightToLeft Languages v. 1.0/1.1 Controls supported RightToLeft reading order Partial RightToLeft alignment and layout v. 2.0 New RightToLeft behavior for: Form, Treeview, StatusBar, ListView, Panel, ProgressBar, Tab, Splitter Controls support full “mirroring” RightToLeft reading order RightToLeft alignment RightToLeft layout 26th Internationalization and Unicode Conference 24 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

25 Click Once New deployment mechanism
Deploy multiple languages from a single project Language property determines: language satellite assemblies language external dependencies Click once language resources (.xml files) Can extend ClickOnce resource languages by localizing setup.xml 26th Internationalization and Unicode Conference 25

26 ASP .NET Localization v. 1.0/1.1 v. 2.0 Used .NET resource model
No design time assistance v. 2.0 Uses .NET resource model Provides a simple declarative model for localization Design time resource generation Edit using VS resource editor Server side compile of .resx files Tag to auto-detect browser culture 26th Internationalization and Unicode Conference 26

27 Developing International Applications with Visual Studio
11/23/2018 7:01 AM Handling Cultures v. 1.0/1.1 Write code to detect browser language Specify preferred culture in web.config, page or code 2.0 Use “auto” to automatically detect browser language Page culture=“auto:fr” uiculture=“auto:fr-FR” .. %> 26th Internationalization and Unicode Conference 27 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

28 Resources Resource format Global Application Resources Local Resources
Use .resx for authoring .NET xml based resource format Global Application Resources Use for global strings or images Stored in \Resources folder Strongly-typed, available to all pages through Resources member. Local Resources Use for page resources Stored in \LocalResources folder Generated through the designer 26th Internationalization and Unicode Conference 28

29 Handling Local Resources
Declaratively Explicit or non-explicit expressions Programmatically System.Web.UI.TemplateControl.GetPageResourceObject() foo.aspx \LocalResources foo.aspx.resx foo.aspx.fr.resx Declaratively: <asp:label runat=“server” id=“foo” text=“<%$ Resources:Title, ‘Welcome’ %>” /> <asp:label runat=“server” meta:ResourceKey=“TitleKey” %> Programmatically: foo.Text = (string)GetPageResourceObject(“Title”, ‘Welcome”); 26th Internationalization and Unicode Conference 29

30 Bi-directionality Direction property on <asp:panel>
Marked Localizable(true) Designer service generates property value in RESX Can be explicitly defined Can be auto assigned through non-explicit expression handling <asp:panel runat=“server” meta:resourcekey=“MainTitle” /> <data name=“MainTitle.Direction” type=“.. ContentDirection”> <value>RightToLeft</value> </data> 26th Internationalization and Unicode Conference 30

31 Developing International Applications with Visual Studio
11/23/2018 7:01 AM ASP .NET Localization Marin Millar Globalization Manager Developer Division 26th Internationalization and Unicode Conference 31 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

32 Developing International Applications with Visual Studio
11/23/2018 7:01 AM Microsoft Newsgroup: microsoft.public.dotnet.internationalization Localization Partner Program More Articles and Code 26th Internationalization and Unicode Conference 32 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

33 Expressions Declarative syntax Interpreted at runtime
Access local or app resources Interpreted at runtime Tool handling in control designers and ‘Expressions …’ (binding) Runtime ‘parse-time’ feature but also support no-compile Explicit and non-explicit forms Explicit form: <%$ Resources:[class,]key[,’default’] %> <asp:label runat=“server” text=“<%$ Resources:MainTitle %>” /> <asp:button runat=“server” text=“<%$ Resources:MyStrings,OK_Key %>”/> Non-explicit form: Meta:ResourceKey=“keyprefix” <asp:label runat=“server” meta:resourcekey=“MainTitle” /> 26th Internationalization and Unicode Conference 33

34 Explicit Expressions Used on any control or object property
Fine-grained handling for properties which are not localizable by default Access application or local resources Runtime Used to obtain resource value and perform property assignment Design-time Developer can create expressions against control properties in “Expressions…” dialog 26th Internationalization and Unicode Conference 34

35 Non-explicit Expressions
Used to partially or fully localize an ‘object’ with minimal syntax Controls, sub-objects, page directive Only used to access local resources Generated by the designer 26th Internationalization and Unicode Conference 35

36 Non-explicit Expressions
Runtime: Default RESX interrogated for keyprefix and properties set Key: filter, keyprefix, control property, sub-property Design-time: Control properties marked [Localizable(true)] are ‘pushed’ to RESX <asp:label runat=“server” meta:resourcekey=“MainTitle” /> <data name=“MainTitle.Text”> <value>Welcome to the site</value> </data> <data name=“MainTitle.Font.Bold” type=“.. Boolean”> <value>true</value> 26th Internationalization and Unicode Conference 36


Download ppt "Developing International Applications with Visual Studio 2005"

Similar presentations


Ads by Google