10 – 12 april 2005 riyadh, saudi arabia. building multi-lingual asp.net application that handle...
TRANSCRIPT
![Page 1: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/1.jpg)
10 – 12 APRIL 2005 Riyadh, Saudi Arabia10 – 12 APRIL 2005 Riyadh, Saudi Arabia
![Page 2: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/2.jpg)
Building multi-lingual ASP.Net application that handle western languages and Arabic
with a single code base.
Building multi-lingual ASP.Net application that handle western languages and Arabic
with a single code base.
Abdellatif TarhineMicrosoft Regional Director for North Africa
![Page 3: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/3.jpg)
AgendaAgendaInternationalizing Your Application
What's New in APS.NET 2.0
Culture-sensitive Formatting
LocalizationResource Expressions
Local and Global Resources
Implicit Expressions to Local Resources
Explicit Expressions to Local Resources
Programmatic Access to Global Resources
Localizing Static Content
Storing Language Preferences
![Page 4: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/4.jpg)
ASP.NET 2.0 Localization Features ASP.NET 2.0 Localization Features
More tools built in to the Microsoft Visual Studio .NET 2005 environment.
New runtime capabilities.
Rich new programming API specifically targeting localization requirements.
![Page 5: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/5.jpg)
Specifying Cultures Specifying Cultures
How do you specify a culture?
there is an Internet standard called RFC 1766 that specifies codes for cultures
ar-SA—Arabic - Saudi Arabia
en-GB—English—United Kingdom
en-US—English—United States
fr-FR—French - France
zh-CN—Chinese - China
the first part (lower case) specifies the language, and the second part (upper case) specifies a country or region
![Page 6: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/6.jpg)
CurrentUICulture & CurrentCulture CurrentUICulture & CurrentCulture
CurrentUICulture—specifies the culture for the user interface and is used for resource file lookups.
CurrentCulture—specifies the culture for data and information. It is used to format dates, numbers, currencies and sort strings
![Page 7: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/7.jpg)
how these settings work?how these settings work?
<%=System.Threading.Thread.CurrentThread. CurrentUICulture.ToString()%>
<%=System.Threading.Thread.CurrentThread. CurrentCulture.ToString()%>
![Page 8: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/8.jpg)
What's New in APS.NET 2.0What's New in APS.NET 2.0
Auto Detection of Browser Language
Declarative Localization Expressions
Generating Local Resources
![Page 9: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/9.jpg)
Culture-sensitive FormattingCulture-sensitive Formatting
Setting a Preferred Language in Internet Explorer
Auto-detecting the browser language for culture-sensitive formatting
<%@ Page Culture="auto:ar-SA" %>
![Page 10: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/10.jpg)
LocalizationResource Expressions LocalizationResource Expressions
There are two forms of resource expressions, explicit and implicit:
Explicit
<%$ Resources:[filename prefix,]resource-key %>
Implicit
<asp:Label ID="Label1" runat="server" meta:resourcekey="resource-key-prefix" />
![Page 11: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/11.jpg)
LocalizationExplicit Expressions to Local ResourcesLocalizationExplicit Expressions to Local Resources
Explicit localization expressions provide a way to declaratively assign specific resource entries to server control properties and other HTML elements
<asp:ImageButton id="btnIDesign" Runat="server" ImageUrl="~/Images/idesignlogo.jpg" AlternateText='<%$ Resources: MissionSatatement, "IDesign Inc." %>' PostBackUrl="http://www.idesign.net" meta:resourcekey="ImageButtonResource1" />
![Page 12: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/12.jpg)
LocalizationExplicit Expressions to Local ResourcesLocalizationExplicit Expressions to Local Resources
Developers can create explicit expressions through the Properties window just as they would set other control properties
![Page 13: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/13.jpg)
LocalizationImplicit Expressions to Local ResourcesLocalizationImplicit Expressions to Local Resources
The default behavior is for an implicit localization expression to be added to server controls, indicated by the parse-time attribute meta:resourcekey.
<asp:LinkButton id=lnkSelectCulture PostBackUrl="selectculture.aspx" runat="server" meta:resourcekey="LinkButtonResource1"> Change Culture Settings</asp:LinkButton>
![Page 14: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/14.jpg)
LocalizationLocal and Global ResourcesLocalizationLocal and Global Resources
Global resources:Reside in a specialized folder called /App_GlobalResources
at the root of the application
Local resources:defined in a peer-level /App_LocalResources folder
![Page 15: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/15.jpg)
LocalizationGenerating Local ResourcesLocalizationGenerating Local Resources
ASP.NET 2.0 provides a simple way to automatically generate resources for Web pages
Generate Local Resource from the Tools menu in Visual Studio 2005
Web Forms, user controls, and master pages can all be internationalized from within Visual Studio .NET 2.0. This particular view shows default resources generated for several pages.
![Page 16: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/16.jpg)
LocalizationLocalizing HTML ElementsLocalizationLocalizing HTML Elements
HTML Controls cannot participate in the benefits of implicit or explicit expressions unless they are run on the server (runat="server").
In fact the HTML page title element is special because it is also a Page property that can be set through the @Page directive.
<%@ page title="Global Welcome" meta:resourcekey="pageTitle" %>
explicit expression that draws the value from shared resources instead
of local resources
<%@ page title='<%$ resource:Glossary, DefaultPageTitle, "Global Welcome" %>' %>
![Page 17: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/17.jpg)
LocalizationDirectional AttributesLocalizationDirectional Attributes
To control the directionality of the browser's scrollbars and set the overall directionality of the site, this explicit expression pulls correct value from shared resources, and uses a designer default, "LTR":
<html runat="server" dir='<% $Resources: Direction, "LTR" %>' >
...
</html>
![Page 18: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/18.jpg)
LocalizationStatic TextLocalizationStatic Text
A new ASP.NET Localize control is provided to mark static content as localizable
<asp:Localize runat="server" meta:resourcekey="welcome">Welcome!</asp:Localize>
<asp:Localize runat="server" text='<%$ resources: Glossary, welcomeText%>'>Welcome!</asp:Localize>
![Page 19: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/19.jpg)
LocalizationResource Localization and DeploymentLocalizationResource Localization and Deployment
New declarative statements, automatic generation of page resources, and the presence of strongly-typed shared resources collectively make it much easier for developers to prepare Web applications for localization
![Page 20: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/20.jpg)
LocalizationPreferred Culture SelectionLocalizationPreferred Culture Selection
ASP.NET 2.0 introduces a new feature to automate culture selection at runtime based on Web browser preferences. The @Page directive, which also supports culture and UI culture settings, can be used to indicate that a particular page should be run based on the browser preferences:
<%@ Page uiCulture="auto" culture="auto">
![Page 21: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/21.jpg)
LocalizationPreferred Culture SelectionLocalizationPreferred Culture Selection
The web.config file for the application can also apply this setting for the entire application
<system.web> <globalization culture="auto:en-US" uiCulture="auto:en">
</system.web>
The colon after auto allows you to specify a default culture if the event HTTP headers are not available. Since culture must be set to a specific culture, the example above shows en-US as the culture.
![Page 22: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/22.jpg)
![Page 23: 10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649eea5503460f94bfb4d6/html5/thumbnails/23.jpg)
© 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only.MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.