0% found this document useful (0 votes)
15 views21 pages

Local Guy S

The document discusses localization support in the .NET framework. It covers topics like localizability, using resources to support multiple languages and cultures, and the localization process. Developers can make applications localizable by avoiding hardcoded strings and images, using culture-neutral assets where possible. The .NET framework provides a resource model with ResX files to define localized resources and satellite assemblies to deploy them. Resources can be loaded at runtime based on the current culture to support multiple languages. Visual Studio helps with localizing Windows Forms applications.

Uploaded by

pisco
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views21 pages

Local Guy S

The document discusses localization support in the .NET framework. It covers topics like localizability, using resources to support multiple languages and cultures, and the localization process. Developers can make applications localizable by avoiding hardcoded strings and images, using culture-neutral assets where possible. The .NET framework provides a resource model with ResX files to define localized resources and satellite assemblies to deploy them. Resources can be loaded at runtime based on the current culture to support multiple languages. Visual Studio helps with localizing Windows Forms applications.

Uploaded by

pisco
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 21

08/2002

Localization Support In
Microsoft .NET Framework
®

Guy
Guy Ron
Ron
.NET
.NET Developer
Developer Advisor
Advisor
Microsoft
Microsoft Israel
Israel
Agenda
 Localizability
 Resources
 Localization Process
 Localizing ASP.NET applications
Localizability
 Readying software to be adapted
for a different culture or language
Common Issues:
Strings Built At Run-time
 Do not concatenate string…
 “Pages visited” + (Today, Monday…) is BAD
 If you really, truly, have to, then…
 Use String.Format:
 “Pages visited {0}” (Today, Monday…)
 However, when translated…
 Páginas visitadas el %s (lunes, martes, …)
 Páginas visitadas %s (hoy)
 Solution: have two separate strings
Common Issues: Graphics
 Use culturally-neutral images
 No baseball or football image for sport
 If you really want to use culture specific
images, put them in resources
 Avoid using text in images
 If text is included, maintain layered
source
Resources And Localization
CultureInfo
 Neutral culture
 Based on language
 Resource only
 No formatting
 CurrentUICulture only
 Specific culture
 Based on language & region
 Resource & Formatting specifics
 CurrentCulture & CurrentUICulture
Resource Model
 .NET Framework uses a new
resource model
 ResX file format
 Resources files
 Satellite Resources DLLs
 Naming conventions
 Resource Fallback
ResX Files
 Simple, (almost) human-readable XML
format
 Can include arbitrary objects
 Created with .NET Framework SDK
 Can also be created with Visual Studio®
Resource Generation Process
 .resx file
 XML-based file .resx file
 Describes resources
 .resources file
 binary compiled file .resources file

 Satellite .resources.dl
l:
 Embedded .resources .resources.dll file
file(s)
Naming Convention
 Naming pattern conventions
 .resources files:
 <myproject>.<xx-XX>.resources
 Satellite assemblies
 <myproject>.resources.dll

 Directory locations for satellites:


 A subdirectory per culture
 either neutral or specific cultures can be used
 Myproject.dll
 \fr\myproject.resources.dll (neutral)
 \de-DE\myproject.resources.dll (specific)
Resource Fallback

Main
Main Assembly
Assembly
•Code
Code
•Neutral
Neutral resources
resources (fallback)
(fallback)
Greeting=“Bonjour”
Greeting=“Bonjour”
Farewell=“Au
Farewell=“Au revoir”
revoir”
Logo=<graphic
Logo=<graphic data>
data>

English
English (en)
(en)
•No
No code
code
•““en”
en” resources
resources
Greeting
Greeting =
= “Hello”
“Hello”
Farewell
Farewell =
= “Goodbye”
“Goodbye”

English
English US
US (en-US)
(en-US)
•No
No code
code
•““en-US”
en-US” resources
resources
Greeting=“Hi”
Greeting=“Hi”
System.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
Loading Resources
 Creating a Resource Manager
 The RM constructor indicates the file from which
resources are to be loaded.
 Several alternatives
 Load from a loose .resources file
 Load from this assembly
 Load from another assembly
 Load from a custom resource format if you write your
own resource manager (e.g., a database)

 See .NET SDK, Samples and Tutorials, ASP.NET


QuickStarts, and How Do I … samples
Loading Resources
 Resource manager can be used to load
both strings and objects:
 RM.GetString(“string”, new CultureInfo(en-NZ ))
 RM.GetString(“string2”)
 RM.GetObject(“Button1.Cursor”)

 Loads requested resources based on


Thread.CurrentThread.CurrentUICulture

 Fallback hierarchy derived from


RFC 1766
Localization Process
 Start with a .txt or a .resx file
 .txt files (string data only)
 .resx files (string data and arbitrary objects)
 XML tools can be used with .resx files
 External localization tools vendor support
 Lionbridge, http://www.lionbridge.com
 WinRes
 Resize Windows® Forms forms
 WinRes does not require access to source
 Visual Studio IDE: integrates this capability
 ResGen
 Compile data to .resources binary files
Localization Process
 AL (SDK linker) or compiler:
 add .resources into assembly.
 al /t:lib /culture:en-NZ
/embed:strings.en-NZ.resources
/out:myapp.resources.dll
 Optional: Use SN for strong-naming
 VS IDE : add translated .resx file into
project
demo
Creating A Windows Form
Localized Application With
Visual Studio
Summary
 .NET Framework provides built-in
support for localization and
globalization
 ASP.NET builds on Framework support
for international app development
 More options for specifying encoding
 Can separate code from resources
 Can utilize .NET Frameworks classes
 Developers can develop/host multi-cultural
apps on a single server
 Visual Studio makes it easier to build
localized apps
References And Questions
 Documentation
 .NET Framework SDK:
 Developing World-Ready Applications
 Samples
 SDK Tools
 Visual Studio .NET
 General info on .NET Framework
 http://msdn.microsoft.com/net
 http://www.GotDotNet.com
 Questions
© 2002 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy