DEV392.NET Framework: Building Applications With Globalization In Mind Michele Leroux Bustamante Principal Software Architect IDesign Inc.

Slides:



Advertisements
Similar presentations
The creation of "Yaolan.com" A Site for Pre-natal and Parenting Education in Chinese by James Caldwell DAE Interactive Marketing a Web Connection Company.
Advertisements

Building International Applications with Visual Studio.NET Achim Ruopp International Program Manager Microsoft Corporation.
 Yaniv Feinberg Senior SDE Microsoft Corporation  Erik Fortune Principal Dev Lead Microsoft Corporation PC52.
Building Localized Applications with Microsoft.NET Framework and Visual Studio.NET Achim Ruopp International Program Manager Microsoft Corp.
Why.NET? Various languages struggling to interoperate with each other Developers undergoing huge learning curves to shift from one language to another.
DEV392: Extending SharePoint Products And Technologies Through Web Parts And ASP.NET Clint Covington, Program Manager Data And Developer Services - Office.
Managing.NET Software Factory Using SYNERGY/Change Kris Kniaz Kniaz.net.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
Week 2 IBS 685. Static Page Architecture The user requests the page by typing a URL in a browser The Browser requests the page from the Web Server The.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Creating Multi-lingual Applications and Websites with Microsoft Visual Studio 2005 Achim Ruopp International Program Manager Microsoft Corporation.
INTRODUCTION TO WEB DATABASE PROGRAMMING
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
© 2004 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Programming the Web Using ASP.Net Chapter 2: The ASP.Net Template Dave.

Unit J: Creating a Database Microsoft Office Illustrated Fundamentals.
DEV302 - Visual Studio Team System Building Robust and Reliable Software Eric Lee Program Manager Microsoft Corporation.
Introduction to ASP.NET. Prehistory of ASP.NET Original Internet – text based WWW – static graphical content  HTML (client-side) Need for interactive.
WorkPlace Pro Utilities.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. ACCESS 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 4 – Creating New.
Sakai: Localization & Internationalization Beth Kirschner University of Michigan
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
Programming with Microsoft Visual Basic 2012 Chapter 12: Web Applications.
WEB326 ASP.NET 2.0: Going Global Gets Easier! New Localization Features in ASP.NET 2.0 Michele Leroux Bustamante Architect, IDesign Microsoft Regional.
Enticy GROUP THE A Framework for Web and WinForms (Client-Server) Applications “Enterprise Software Architecture”
The Company….  The Market Leader in Globalization Technology –Pioneers in visual translation environments –Solutions for major platforms & programming.
E-Commerce: Introduction to Web Development 1 Dr. Lawrence West, Management Dept., University of Central Florida Topics What is a Web.
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
2. Introduction to the Visual Studio.NET IDE. Chapter Outline Overview of the Visual Studio.NET IDE Overview of the Visual Studio.NET IDE Menu Bar and.
ASP.NET.. ASP.NET Environment ASP.NET is Microsoft's programming framework that enables the development of Web applications and services. It is an easy.
.NET Framework Danish Sami UG Lead.NetFoundry
The Web Architecture and ASP.NET. Slide 2 Review of the Web (1) It began with HTTP and HTML, which delivers static Web pages to browsers which would render.
Globalization Support in Microsoft.NET Framework François Liger Program Manager Microsoft Corporation.
Deploy.NET Applications with Ease Brian Noyes IDesign, Inc.
10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base.
DEV382 Building International Applications with the.NET Framework Christian Nagel Microsoft Regional Director Global Knowledge.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
WaveMaker Visual AJAX Studio 4.0 Training Basics: Building Your First Application Binding Basics.
Database Handling, Sessions, and AJAX. Post Back ASP.NET Functionality The IsPostBack method in ASP.NET is similar to the BlackBerry.refresh method –IsPostBack.
DEV 301 Visual Studio Team System Tom Arnold Program Manager Microsoft Corporation “Enabling Better Software through Better Testing”
Microsoft Dynamics NAV 2009 and Architecture Overview Name Title Microsoft Corporation.
Localization Support in Microsoft.NET Framework François Liger Program Manager Microsoft Corporation.
Internationalization in ASP.NET 2.0. SQL Server 2005 – Data Columns Use Unicode datatypes in: Table columns, CONVERT() and CAST() operations Use Unicode.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
1 EndNote X2 Your Bibliographic Management Tool 29 September 2009 Humanities and Social Sciences Resource Teams.
I18n = g11n + L10n Adam Long & Sam Soubra QSR International March 2009.
Microsoft FrontPage 2003 Illustrated Complete Integrating a Database with a Web Site.
MBL 305 ASP.NET Mobile Controls: Best Practices Gökşin Bakir CSA Yage Ltd. Microsoft Regional Director.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
ASP. ASP is a powerful tool for making dynamic and interactive Web pages An ASP file can contain text, HTML tags and scripts. Scripts in an ASP file are.
Forms Manager. What is Forms Manager? Forms Manager is a completely new online form creation and form data management tool.
Internationalization Andres Käver, IT Kolledž 2015.
DAT 378 SQL Server 2000 Bringing The Best of Reporting Services and Analysis Services Together Sean Boon Program Manager, BI Systems
CHAPTER 7 LESSON C Creating Database Reports. Lesson C Objectives  Display image data in a report  Manually create queries and data links  Create summary.
Developer Exam Preparation Thom Robbins Bryan Soltis
Introduction to ASP.NET, Second Edition2 Chapter Objectives.
DEV410 Inside the ASP.NET Runtime - Intercepting HTTP Requests Michele Leroux Bustamante Principal Software Architect IDesign Inc.
Working in a Mobile App Development Environment Lesson 2.
7/23/2016 CSC 325 Advanced Programming Techniques Localization Slide #1 1 Localization Mikhail Brikman.
Chapter 1 Getting Started with ASP.NET Objectives Why ASP? To get familiar with our IDE (Integrated Development Environment ), Visual Studio. Understand.
INF230 Basics in C# Programming
Working in the Forms Developer Environment
Metropolia 2013 C# programming and .NET framework
Globalization support in ASP.NET
Serpil TOK, Zeki BAYRAM. Eastern MediterraneanUniversity Famagusta
Unit J: Creating a Database
Presentation transcript:

DEV392.NET Framework: Building Applications With Globalization In Mind Michele Leroux Bustamante Principal Software Architect IDesign Inc.

Speaker BIO Principal Software Architect, IDesign, Microsoft Regional Director, Microsoft MVP – XML Web Services INETA Speaker’s Bureau BEA Technical Director Web Services Program Advisor, UCSD Blog:

Agenda What is Globalization? Localization and Application Architecture.NET Resources Runtime Culture Selection Windows Forms Architecture ASP.NET Architecture

What Is Globalization? Designing applications to be adapted to the global marketplace Affects display, input, formats & conventions Localizability Separate culture dependencies from code Localization Adapting applications for a particular market Content translation, feature customization Changes independent of compiled source

Locale/Culture Language and cultural environment International Standards Organization (ISO) Conventions Language Code - ISO I.e., en, fr, de, es Country Code - ISO 3166 I.e., CA, US, EC, ES Together, they identify culture I.e., en-CA, en-US, es-EC, es-ES See RFC 3066 – Tags for identifying languages

Agenda What is Globalization? Localization and Application Architecture.NET Resources Runtime Culture Selection Windows Forms Architecture ASP.NET Architecture

What To Localize? Static Application Content Usually “hard-coded” for presentation For example Menu captions Control captions Labels, buttons, selection options, list options Web page content *.aspx, *.ascx, *.html, *.xml

What To Localize? Dynamic Application Content Content populated at runtime from XML files, databases, and other data sources Need location of content to be organized by culture Need filenames, connection strings and queries to be configurable by culture

Storing Localized Content Deployment architecture is affected by location of localized application content Resources, file system, database, external applications Choices influenced by application type Windows versus Web And by business requirements Frequency of culture translations Ease of translation process Frequency of application maintenance

Satellite Assemblies Culture-Specific Subdirectories GlobalApp.Resources.dll GlobalApp.Resources.dll GlobalApp.Resources.dll GlobalApp.exe Resources Windows Forms Resources \en-CA \es \es-EC Main Assembly Application Directory Code Types Form1Common Form1 Form1 Form1 Internal Common Common Common Internal Internal Internal

Satellite Assemblies Culture-Specific Subdirectories Windows Forms Resources and data GlobalApp.exe GlobalApp.Resources.dll GlobalApp.Resources.dll GlobalApp.Resources.dll \en-CA \es \es-EC Products Products_en-CA Products_es Main Assembly Application Directory resources resources resources resources Database Content

ASP.NET Duplicate Content GlobalWeb.dll Products GlobalWeb\bin Global.asax Web.config logo.gif Web Application Resources page and user control content Database Content

ASP.NET Duplicate Content GlobalWeb.dll Products Products_en-CA Products_es GlobalWeb \en-CA \bin \es Global.asax Web.config logo.gif logo.en-CA.gif logo.es.gif Web Application Resources page and user control content translated page and user control content Database Content

ASP.NET Single Content Base GlobalWeb.dll Products Products_en-CA Products_es GlobalWeb\bin Global.asax Web.config logo.gif logo.en-CA.gif logo.es.gif Satellite Assemblies \en \en-CA \es GlobalWeb.en.dll GlobalWeb.en-CA.dll GlobalWeb.es.dll Web Application Resources list.en-CA.xml list.es.xml resources resources resources resources Database Content translated file content

Agenda What is Globalization? Localization and Application Architecture.NET Resources Runtime Culture Selection Windows Forms Architecture ASP.NET Architecture

What Are.NET Resources? XML Resources (*.resx) Automatically generated by VS.NET for each Windows Form and Web Form By default, compiled and embedded in project assembly Can add custom resources to the project Can build assemblies that contain shared resources

What Are.NET Resources? ILDASM View

How Are Resources Created? Localizable = false this.button1.Location = new System.Drawing.Point(88, 112); this.button1.Name = "button1"; this.button1.TabIndex = 0; this.button1.Text = "button1";

How Are Resources Created? Localizable = true this.button1.Location = ((System.Drawing.Point) (resources.GetObject("button1.Location"))); this.button1.Name = "button1"; this.button1.Size = ((System.Drawing.Size) (resources.GetObject("button1.Size"))); this.button1.TabIndex = ((int)(resources.GetObject("button1.TabIndex"))); this.button1.Text = resources.GetString("button1.Text"); this.button1.TextAlign = ((System.Drawing.ContentAlignment) (resources.GetObject("button1.TextAlign"))); this.button1.Visible = ((bool)(resources.GetObject("button1.Visible")));

How Are Resources Created? (Default) Culture Main assembly Neutral Culture Spanish (es) Specific Culture Spanish (Ecuador) (es-EC) Spanish (Mexico) (es-MX) Triggers satellite assembly generation

Localizing A Windows Form

Satellite Assemblies Defined for each language and culture Hub and spoke model Contain only resources - No code! Individual version updates No impact to main executable Directory structure and naming conventions Runtime follows a resource fallback process to find closest match

Satellite Assemblies ILDASM View

Satellite Assemblies Resource Deployment Satellite Assemblies Culture-Specific Subdirectories GlobalApp.Resources.dll GlobalApp.Resources.dll GlobalApp.Resources.dll GlobalApp.exe Resources \en-CA \es \es-EC Main Assembly Application Directory Code Types Form1Common Form1 Form1 Form1 Internal Common Common Common Internal Internal Internal

Compiling Resources ColorPicker.Resources.dll ColorPicker.exe Resources \en \en-CA \es Code Types Form1 Strings Form1 Strings ColorPicker.Resources.dll Form1 Strings CommonRes.Resources.dll Errors CommonRes.Resources.dll Errors CommonRes.Resources.dll Errors

Resource Source Resource source files Text (*.txt) – string resources XML (*.resx) – string or binary resources Default XML resources provided for Windows and Web Forms Can manually add custom resources VS.NET automatically compiles satellite assemblies [ResourceType].[Culture].resx

Adding XML Resources

Compiling Resources Can be done from command line to automate build process Resource Generation Tool (resgen.exe) Compiled to intermediate *.resources Compiled resources are embedded in or linked to an assembly resgen strings.en-CA.txt GlobalWebApp.strings.en-CA.resources resgen common.es.resx GlobalWebApp.common.es.resources

Compiling Resources Assembly Linker Tool (al.exe) Must provide culture /c: setting Use /template: to inherit assembly metadata al /t:lib /out:GlobalApp.resources.dll /v: /c:en-CA /embed:GlobalApp.strings.en-CA.resources /embed:GlobalApp.common.en-CA.resources al /t:lib /out:GlobalApp.resources.dll /c:es /embed:GlobalApp.strings.es.resources /embed:GlobalApp.strings.es.resources /template:../GlobalApp.exe

Locating Resources Resource files share the same name [assemblyname].resources.dll Manifest specifies culture [assemblyname].[resourcetype].[culture].resources Deployed to culture-specific subdirectories \[culture] for Windows Forms deployments \bin\[culture] for ASP.NET deployments

Locating Resources Best match is current thread’s UI culture en-CA, en-US Neutral parent culture is next best fit en Last resort is default from main assembly (default) en-CA en-US en (default)

Locating Resources Identify the default resource culture [assembly: NeutralResourcesLanguageAttribute("en")] Default resources will be used instead of searching for matching satellite assembly en-CA en-US en (default) en

Assembly Manifest

ResourceManager System.Resources.ResourceManager Access specific resource type: Form1, Form2, Strings, Errors, Common Request resource entries by key name button1.Text = rm.GetString(“button1.Text”); int n = (int)rm.GetObject(“count”); string s = rm.GetString(“message”); System.Resources.ResourceManager rm = new System.Resources.ResourceManager(typeof(Form1));

ResourceManager Use helper methods to retrieve resources GetObject(), GetString() Access specific resources by name GetResourceSet() Access resources for a particular culture No resource fallback ReleaseAllResources() Free resources from memory

ResourceManager Direct access to satellite assemblies Returns resources for the current thread’s UI culture setting: To customize set Thread.CurrentThread.CurrentUICulture If resource entry not found in satellite assembly for the current culture, ResourceManager performs resource fallback to find a valid entry

Agenda What is Globalization? Localization and Application Architecture.NET Resources Runtime Culture Selection Windows Forms Architecture ASP.NET Architecture

Runtime Culture Selection The current thread’s culture settings dictate resource selection CurrentUICulture Property Controls resource selection CurrentCulture Property Controls culture-aware data formatting

Runtime Culture Selection System.Globalization.CultureInfo Encapsulates language and region

CurrentUICulture System.ThreadingThread.CurrentThread.CurrentUICulture Defaults to system UI language, or: Or, request specific ResourceSet But, you may lose resource fallback feature Thread.CurrentThread.CurrentUICulture = new CultureInfo("es"); ResourceManager rm = new ResourceManager(typeof(Form1)); ResourceSet rset = rm.GetResourceSet(new CultureInfo("es"), true, true);

Accessing Resources

CurrentCulture System.ThreadingThread.CurrentThread.CurrentCulture Defaults to user locale, can be changed Thread.CurrentThread.CurrentCulture = new CultureInfo("es"); DateTime dt = DateTime.Now; String s = dt.ToLongDateString(); // formatted for the current culture

Culture-Specific Formatting System.Globalization Utility classes support formatting and conversion based on culture Formatting Classes Sorting: SortKey, CompareInfo String comparison: CompareInfo Date and time: DateTimeFormatInfo Numbers: NumberFormatInfo Calendar data: Calendar

Culture-Specific Formatting

Agenda What is Globalization? Localization and Application Architecture.NET Resources Runtime Culture Selection Windows Forms Architecture ASP.NET Architecture

Windows Forms Resource Allocation Control properties automatically stored in embedded resources Allows translators to edit individual form layout without touching your code Other content stored in shared resources Shared between forms, separate resource Shared between application or assemblies, separate resource assembly

Main Assembly Application Directory Windows Forms GlobalApp.exe GlobalApp.Resources.dll \en-CA \es \es-EC Products Products_en-CA Products_es Form1.en-CA.resources Strings.en-CA.resources Common.Resources.dll Common.en-CA.resources GlobalApp.Resources.dll Form1.es.resources Strings.es.resources Common.Resources.dll Common.es.resources GlobalApp.Resources.dll Strings.en-CA.resources Form1.en-CA.resources Strings.en-CA.resources Common.Resources.dll Common.en-CA.resources

Windows Forms Architecture

Agenda What is Globalization? Localization and Application Architecture.NET Resources Runtime Culture Selection Windows Forms Architecture ASP.NET Architecture

ASP.NET Duplicate Content Goals Facilitate rapid 1.0 release Deal with translation later Translate content for each culture I.e., ASPX, ASCX, HTML, XML Other source files selected by culture I.e., GIF, JPG Can redirect to localized set of pages Translators edit content source Error prone

ASP.NET Duplicate Content GlobalWeb.dll Products Products_en-CA Products_es GlobalWeb \en-CA \bin \es Global.asax Web.config logo.gif logo.en-CA.gif logo.es.gif Web Application Resources page and user control content translated page and user control content Database Content

Culture-Specific Directories Subdirectories named by culture Filenames and navigation are untouched Content duplicated per sub-directory Filenames include culture Useful for shared directories I.e., \Images\logo.gif, \Images\logo.es-EC.gif Use resources to store filename!

/Articles subdirectory is relative to application path /default.aspx represents default page for neutral culture Once redirected to culture- specific directory, navigation should be relative CurrentUICulture=“es” Culture-Specific Directories

Culture-Specific Filenames CurrentUICulture=“es”

ASP.NET Configuration Machine.config Default settings for Default settings for Web.config Application-specific settings <globalization requestEncoding=“utf-8" responseEncoding=“utf-8" fileEncoding=“utf-8" culture=“en-CA" uiCulture=“en-CA" />

uiCulture Sets the UI culture for resource resolution ResourceManager respects this setting culture Sets culture formatting for processing requests Culture-sensitive classes respect this setting Formatting date, time and currency Calendar Sorting and list separators

@ Page Directive Culture settings for a particular page Overrides settings for the project or subdirectory Culture Sets culture formatting for this page UICulture Sets the UI culture for this page for resource resolution

Single Content Base Goals One code base Low impact future translations Alternative to direct page translation Dynamic page content XML, database or other data source Issues How do translators access data source? How do Web designers integrate?

ASP.NET Single Content Base GlobalWeb.dll Products Products_en-CA Products_es GlobalWeb\bin Global.asax Web.config logo.gif logo.en-CA.gif logo.es.gif Satellite Assemblies \en-CA \es \es-EC GlobalWeb.en-CA.dll GlobalWeb.es.dll GlobalWeb.es-EC.dll Web Application Resources list.en-CA.xml list.es.xml resources resources resources resources Database Content translated file content

Single Content Base And Presentation Layer CurrentUICulture=“es”

ASP.NET And Resources XML resources provided for global.asax and Web forms Embedded in main assembly Manually add resources for other cultures

ASP.NET And Resources Add new resource file to the project [resourcetype].[culture].resx Satellite resources deployed for each culture Beneath culture-named subdirectories ASP.NET shadow-copies assemblies (XCOPY deployment) Not used for significant blocks of content

Culture Preferences Browser Language Preferences Information is passed HTTP header GET WebForm1.aspx HTTP/1.1 Connection: Keep-Alive Accept: */* Accept-Encoding: gzip, deflate Accept-Language: en-us;q=0.8,es-ec; q=0.6,fr-ca;q=0.4,de;q=0.2; ja Host: localhost User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0;.NET CLR )

Culture Preferences User Selection Allow users to change culture/language settings Cookies May not be supported, and may be deleted Session Storage Good for the duration of current session User Profile Persist user settings

ASP.NET Localization

Session Summary You learned about.NET support for resources and culture formatting You’ve seen some sample deployment architectures for Windows Forms and ASP.NET You should have a better idea how to employ a combination of resources, external data sources and culture- specific files You are ready to think global!

Call to Action Globalization planning should begin with V1.0 Otherwise, can require extensive re- architecture of existing solutions Lots of product defects waiting to happen Aggressive schedules are a given Procrastination only lengthens release cycle for V2.0

For More Information Microsoft Newsgroup: microsoft.public.dotnet.internationalization Localization Partner Program More Articles and Code ault.aspx?pull=/library/en-us/dnaspp/html/aspnet- globalarchi.asp ault.aspx?pull=/library/en-us/dnaspp/html/aspnet- globalarchi.asp

Attend a free chat or web cast List of newsgroups communities/newsgroups/en-us/default.aspx MS Community Sites Locate Local User Groups Community sites

Q1:Overall satisfaction with the session Q2:Usefulness of the information Q3:Presenter’s knowledge of the subject Q4:Presenter’s presentation skills Q5:Effectiveness of the presentation Please fill out a session evaluation on CommNet