Globalization - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

Globalization

Description:

LeftToRight vs. RightToLeft Alphabet, Arabic. Currency Formatting $, , , (Japanese are always interesting because they never ... – PowerPoint PPT presentation

Number of Views:44
Avg rating:3.0/5.0
Slides: 18
Provided by: chrish84
Category:

less

Transcript and Presenter's Notes

Title: Globalization


1
Ottawa .Net CommunityMCTS 70-526 Study Group
  • Chapter 11
  • Lesson 2
  • Globalization Localization

2
Overview
  • Why do it?
  • To present your App with appropriate formatting,
    in the language, or Culture, appropriate for
    your intended audience.
  • Especially in Ottawa, all our apps should be
    bi-lingual!

3
What is a Culture?
  • A Culture refers to cultural information
    pertaining to a particular country or region,
    such as
  • Language (French, English)
  • LeftToRight vs. RightToLeft Alphabet, Arabic
  • Currency Formatting , , , (Japanese are always
    interesting because they never display decimal
    places)
  • Date Formats
  • Colour (in some cultures, RED may be an
    undesirable colour)

4
Culture Codes
  • Culture Codes define what culture your app will
    used as defined in the CultureInfo Class.
  • The CultureInfo class contains built-in
    information about cultures based on the set
    CultureCode.
  • Codes format
  • ltLanguagegt and/or ltRegiongt and/or ltAlphabetgt
  • Ie. en English
  • fr-CA French Canada
  • uz-UZ-Latn Uzbek, Uzbekistan, Latin alphabet

5
How to set Culture?
  • Set the Culture of an application by setting
    the current thread to a new instance of the
    CultureInfo class
  • Sytem.Threading.Thread.CurrentThread.CurrentUIC
    ulture new System.Globalization.CultureInfo(
    fr-CA)
  • Set Culture before the form has been created,
    either
  • in the forms constructor
  • or in the Apps main method

6
Culture vs. UICulture
  • The Culture value determines the results of
    culture-dependent functions, such as the date,
    number, and currency formatting, and so on.
  • The UICulture value determines which resources
    are loaded for the page.
  • Samples
  • System.Threading.Thread.CurrentThread.CurrentCultu
    re New System.Globalization.CultureInfo("fr-FR")
  • System.Threading.Thread.CurrentThread.CurrentUICul
    ture New System.Globalization.CultureInfo("fr-FR
    ")

7
How to Culturize your App?
  • Easily done with
  • Globalization (Data formatting)
  • Localization (Language used in text)
  • Mirroring Forms (built-in function)
  • Setting properties programmatically (like colours)

8
Globalization
  • The process of formatting application data in
    formats appropriate for the locale
  • Also referred to as internationalization (i18n)
  • Applies to data
  • Correct Text Format(500,currency)
  • Wrong Text 500.00

9
Localization
  • The process of loading displaying localized
    strings, defined in resource files, in the User
    Interface
  • Ie. All text in the form is displayed in the
    language desired by your audience.
  • Also called (L10n)
  • Applies to static text on a form
  • Visual Studio automatically creates resource
    files for you

10
How to Localize a Form?
  • Only available at design time
  • Set Form.Localizable True
  • Set Form.Language ltselect a language from the
    listgt
  • This puts you in Localize mode (can not add any
    other controls while in this mode)
  • Set language to default to go back into Design
    mode
  • Type in your new text in the selected language,
    then, when you save the form, Visual Studio
    automatically creates a Resource file for you
    (ie. Form.en-CA.resx)

11
Reference Culture Code
  • Refer to the current Culture Code by
  • Globalization.CultureInfo.CurrentCulture.ToString

12
Default Language
13
Set default language in the Control Panel
14
App.Config
  • You can set the default Culture used by the App
    in the App.Config file
  • ltglobalization uiculture"en" culture"en-CA" /gt

15
Right to Left
  • Why? Depending on language, text may be read
    RightToLeft
  • How? Set Control.LeftToRight Property
  • text alignment reversed
  • form captions on right
  • vertical scroll bars on left
  • inherits Parent setting
  • Actual data content is unchanged

16
Mirroring
  • Simply displays the form in its mirrored layout
    (all controls flipped vertically to other side of
    the form).
  • 1. Set Form.RightToLeftlayout TRUE
  • 2. Set Form.LeftToRight TRUE
  • The form will appear mirrored.
  • NOTE Must set both properties.
  • Setting 1. on its own does nothing.
  • Setting 2. on its own changes the orientation
  • of each control individually.

17
Demo
  • Create a multi-lingual app using Globalization
    Localization
  • Use Mirroring
  • Set properties based on CultureCode
  • Creating Resource Files
  • Set default Culture in Control Panel vs.
    App.Config
Write a Comment
User Comments (0)
About PowerShow.com