windows language support l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Windows Language Support PowerPoint Presentation
Download Presentation
Windows Language Support

Loading in 2 Seconds...

play fullscreen
1 / 130

Windows Language Support - PowerPoint PPT Presentation


  • 431 Views
  • Uploaded on

Windows Language Support. Presenter: Erik Fortune MUI Development Manager Microsoft Corporation. Multilingual Matters!. Presentation Outline. Overview in Windows international settings Overview of language support in Windows Vista Deploying Windows Vista for multilingual scenarios

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Windows Language Support' - lakia


Download Now An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
windows language support

Windows Language Support

Presenter: Erik Fortune

MUI Development Manager

Microsoft Corporation

presentation outline
Presentation Outline
  • Overview in Windows international settings
  • Overview of language support in Windows Vista
  • Deploying Windows Vista for multilingual scenarios
  • Developing Globalized Applications on Windows Vista
  • Developing Win32 MUI Applications
  • Q&A
presentation goals
Presentation Goals
  • Attendees should leave this session with:
    • Familiarity with Windows multilingual functionality and related settings
    • Familiarity with multilingual deployment options for Windows Vista
    • Familiarity with infrastructure and APIs provided in Windows Vista for developing globalized applications
    • Pointers to additional information and resources
  • Out of scope: general Windows programming concepts
assumptions
Assumptions
  • Familiarity with the basic concepts of writing globalized applications.
  • Familiarity with Windows Win32 application development.
international settings in windows vista7
International Settings in Windows Vista
  • Control panels:
    • Regional and Language Options
    • Date and Time
international settings in windows vista9
International Settings in Windows Vista
  • Regional and Language Options:
    • Format: defaults for
      • Number formatting
      • Currency format
      • Date formats
      • Time formats
      • Sorting
      • Other user experiences involving user cultural preferences
international settings in windows vista10
International Settings in Windows Vista
  • Regional and Language Options:
    • Format: defaults for
      • Number formatting
      • Currency format
      • Date formats
      • Time formats
      • Sorting
      • Other user experiences involving user cultural preferences
international settings in windows vista11
International Settings in Windows Vista
  • Regional and Language Options:
    • Format: customizable defaults
international settings in windows vista12
International Settings in Windows Vista
  • Regional and Language Options:
    • Format: customizable defaults
international settings in windows vista13
International Settings in Windows Vista
  • Regional and Language Options:
    • Location
international settings in windows vista14
International Settings in Windows Vista
  • Regional and Language Options:
    • Keyboards and Languages
      • Enable/disable languages forinput & editing documents
      • Select keyboard layouts or other input methods
international settings in windows vista15
International Settings in Windows Vista
  • Regional and Language Options:
    • Keyboards and Languages
      • Enable/disable languages forinput & editing documents
      • Select keyboard layouts or other input methods
international settings in windows vista16
International Settings in Windows Vista
  • Regional and Language Options:
    • Keyboards and Languages
      • Enable/disable languages forinput & editing documents
      • Select keyboard layouts or other input methods
international settings in windows vista17
International Settings in Windows Vista
  • Regional and Language Options:
    • Keyboards and Languages
      • Change language for Windowsuser interface
        • Not all SKUs
international settings in windows vista18
International Settings in Windows Vista
  • Regional and Language Options:
    • Administrative
      • Machine-wide settings
        • “System locale”
          • Code page used by legacy apps
          • Also impacts some font behaviours (font linking)
international settings in windows vista19
International Settings in Windows Vista
  • Regional and Language Options:
    • Administrative
      • Machine-wide settings
        • Copy to reserved accounts
          • Default settings for new users
international settings in windows vista20
International Settings in Windows Vista
  • Regional and Language Options:
    • Can apply settings from command line

control intl.cpl,, /f:"settingsfile.xml"

    • http://www.microsoft.com/globaldev/vista/vista_tools/vista_command_line_international_configuration.mspx
  • <gs:GlobalizationServicesxmlns:gs="urn:longhornGlobalizationUnattend">
    • <!--User List-->
    • <gs:UserList>
    • <gs:UserUserID="Current"/>
    • </gs:UserList>
    • <!--User Locale-->
    • <gs:UserLocale>
    • <gs:Locale Name="en-US" SetAsCurrent="true"/>
    • </gs:UserLocale>
    • </gs:GlobalizationServices>
multilingual support in windows vista22
Multilingual Support in Windows Vista
  • Various possible levels of language support
    • Text display
    • Editing: text display and input method(s)
      • Keyboard layout or IME
    • Locale
      • Formats, collation, calendar
    • Localization
      • Partial — Complete
    • Extended language functionality
      • Voice: text-to-speech, speech recognition
      • Handwriting recognition
      • Language detection
      • Word breaker, stemmer; proofing tools
text display enablement
Text-display enablement
  • Includes:
    • Complex-script shaping support (if needed)
    • Fonts (at least one)
    • Font fallback
    • Implemented in Win32 APIs/controls
      • ExtTextOut, DrawText, User/common controls, RichEdit

May or may not get implemented:

    • Dictionary-based line breaking
    • Special vertical-layout behaviour
    • Other frameworks (e.g. GDI+, WPF)
text display enablement scripts
Text-display enablement: scripts
  • Windows XP
    • Europe: Latin, Cyrillic, Greek
    • W. Asia: Arabic, Armenian, Georgian, Hebrew, Syriac
    • E. Asia: CJK (Simplified, Traditional, Kana, Hangul, CJK Extension B)
    • S.E. Asia: Thai
    • S. Asia: Devanagari, Gujarati, Gurmukhi, Kannada, Telugu, Tamil, Thaana
    • Surrogates
text display enablement scripts25
Text-display enablement: scripts
  • Windows XP SP2
    • Europe: Latin, Cyrillic, Greek
    • W. Asia: Arabic, Armenian, Georgian, Hebrew, Syriac
    • E. Asia: CJK (Simplified, Traditional, Kana, Hangul, CJK Extension B)
    • S.E. Asia: Thai
    • S. Asia: Bengali, Devanagari, Gujarati, Gurmukhi, Kannada, Malayalam, Telugu, Tamil, Thaana
    • Surrogates
text display enablement scripts26
Text-display enablement: scripts
  • Windows XP
    • CJK, “complex” scripts not enabled in all SKUs by default
text display enablement scripts27
Text-display enablement: scripts
  • Windows Vista
    • Europe: Latin, Cyrillic, Greek
    • W. Asia: Arabic, Armenian, Georgian, Hebrew, Syriac
    • E. Asia: CJK (Simplified, Traditional, Kana, Hangul, CJK Extension B), Mongolian, Yi
    • S.E. Asia: Khmer, Lao, Thai
    • S. Asia: Bengali, Devanagari, Gujarati, Gurmukhi, Kannada, Malayalam, Oriya, Sinhala, Telugu, Tamil, Thaana, Tibetan
    • Americas: Cdn Aboriginal Syllabics, Cherokee
    • Africa: Ethiopic
    • Surrogates
text display enablement scripts28

Loa text with DokChampa Font

Oriya text with Kalinga Font

Khmer text with DaunPenh Font

Sinhala text with IskoolaPota Font

Text-display enablement: scripts
text display enablement scripts29
Text-display enablement: scripts
  • Windows Vista
    • Text display for all scripts always enabled (all editions / SKUs)
      • Note: some perf considerations
text display enablement scripts30
Text-display enablement: scripts
  • Other enhancements:
    • Enhanced font fallback for Extension B
      • MingLiU vs. MingLiU_HKSCS vs. Simsun
    • Uniscribe
      • OpenType APIs
        • Apply discretionary OpenType feature tags
        • Apply OpenType language-system tags
      • Performance

Demo

text display enablement fonts
Text-display enablement: fonts
  • Many new fonts
    • New fonts for newly-supported scripts
    • New “Aero”-theme UI fonts (ClearType hinting)
text display enablement fonts32
Text-display enablement: fonts
  • Many new fonts
    • New ClearType-hinted document fonts
    • Other new fonts
text display enablement fonts33
Text-display enablement: fonts
  • Additions to existing fonts: Unicode 5.0 updates
text display enablement fonts35
Text-display enablement: fonts

Font smoothing: ClearType selected by default

  • Tuning: http://www.microsoft.com/typography/ClearTypeInfo.mspx
text display enablement36
Text-display enablement
  • Other graphics frameworks
    • GDI+
      • Small increase in script support:
        • New: Oriya; Arabic/Hebrew/Thai OpenType
      • Comparison with GDI:
        • Support for ClearType hinting
        • Support for TrueType-flavour OpenType fonts
        • Support for OpenType fonts with embedded bitmaps
        • No support for Type 1/CFF-OpenType, bitmap/vector .FON
        • Unsupported scripts: Mongolian, Sinhala, Tibetan
text display enablement37
Text-display enablement
  • Other graphics frameworks (cont’d)
    • Windows Presentation Foundation (.Net 3.5)
      • New text stack (.Net 3.0): managed-code shaping engines
      • ClearType, sub-pixel glyph positioning
      • Comparison with GDI
        • GDI does not support sub-pixel positioning
        • Support for OpenType fonts (TrueType or CFF outlines)
        • No support for embedded bitmaps
        • No support for Type 1, bitmap/vector .FON
        • Unsupported scripts: Khmer, Old Hangul, Sinhala
text display enablement38
Text-display enablement
  • Other graphics frameworks (cont’d)
    • Windows Presentation Foundation (.Net 3.5)
      • ClearType, sub-pixel glyph positioning
text display enablement39
Text-display enablement
  • Summary
    • Support for scripts used by all major languages with broad market interest, and hundreds of lesser-known languages
      • Most significant gap in current coverage: Myanmar
    • Enablement and fonts for a large portion of Unicode 5.0
      • Many characters not covered in Vista fonts will display in documents using 3rd-party fonts
    • Support for advanced typography
      • WPF, Win32 (low-level APIs)
text input
Text Input
  • Types of input
    • Keyboard / IME
    • Speech
      • Speech recognition
      • Text-to-speech
    • Hand-writing recognition
  • Infrastructure
    • Text Services Framework
text input41
Text Input
  • New keyboard layouts (non-IME)
text input42
Text Input
  • IMEs
    • CJK IME enhancements
      • Addition character support
        • JIS 2004, Extension B
      • Improved UI, dictionaries, logic
      • New input modes
      • IME Pad available from all IMEs
    • Yi
    • Amharic
text input43
Text Input
  • Handwriting recognition
text input44
Text Input
  • Voice
    • Speech recognition
    • Text-to-speech
    • Installed with UI language pack
locale data
Locale Data
  • Locale: default cultural conventions (formats, etc.)
    • Language / writing system / region
    • 35 new Vista locales
    • 206 total locales
locale data46
Locale Data
  • Calendars
    • New: Saudi Hijri (Um Al Qura)
    • Supported calendars:
      • Gregorian
      • Hebrew (lunar)
      • Hijri
      • Japanese Imperial Era
      • Korean Tangun Era
      • Taiwan
      • Thai
      • Um Al Qura (Saudi Hijri)
ui localization
UI Localization
  • Translate user-interface (menus, dialogs, etc) & helps
    • Different levels of localization
      • Language Packs for 36 SKU languages
        • Full
        • Partial + base language
      • Language Interface Packs (LIPs)
        • Most common UI only
ui localization48
UI Localization
  • SKU-level localization
    • Windows XP: 25

Arabic

Finnish

Polish

French

Brazilian Portuguese

Portuguese

German

Chinese – Simplified

Russian

Greek

Chinese – Traditional

Hebrew

Chinese – Traditional (HK)

Hungarian

Italian

Spanish

Czech

Japanese

Swedish

Korean

Danish

Dutch

Turkish

English

Norwegian -- Bokmål

ui localization49
UI Localization
  • SKU-level localization
    • Windows Vista: 36

Arabic

Finnish

Polish

French

Brazilian Portuguese

Portuguese

Bulgarian

Romanian

German

Chinese – Simplified

Russian

Greek

Chinese – Traditional

Serbian – Latin

Hebrew

Slovak

Chinese – Traditional (HK)

Hungarian

Slovenian

Croatian

Italian

Spanish

Czech

Japanese

Swedish

Korean

Danish

Thai

Dutch

Latvian

Turkish

Lithuanian

English

Ukrainian

Norwegian -- Bokmål

Estonian

ui localization50
UI Localization
  • SKU languages
    • Full, partial
    • Multilingual User Interface (MUI)
      • Ultimate / Enterprise edns
      • User-selected UI language
      • Single-image deployment for multiple languages
ui localization51
UI Localization
  • Language Interface Packs (LIPs)
    • Limited, common-UI (20-80 rule)
    • Tied to a parent language
    • 60+ languages
ui localization52
UI Localization
  • Obtaining language packs
    • SKU languages
      • ~150MB (expand to ~1GB)
      • Ultimate: Vista Ultimate Extras (Windows Update)
      • Enterprise: Language Pack CD-ROM
      • Language of retail SKUs: availability depends on region
    • LIP languages
      • Can only be installed on parent language
      • Free download
        • http://www.microsoft.com/unlimitedpotential/programs/llp.mspx
other global features in vista
Other Global Features in Vista
  • World clocks
  • Indexing
    • Diacritic-sensitive
      • Indexing Options control Panel
other global features
Other Global Features
  • International Domain Names (IDNA)
    • Scam protection
      • Show only IDNs that match IE language settings
extensible enablement
Extensible enablement
  • Text display
    • Can add new fonts, but not new complex-script shaping engines
  • Input
    • Microsoft Keyboard Layout Creator (MSKLC)
      • Basic layouts (no IMEs)
      • http://www.microsoft.com/globaldev/tools/msklc.mspx
      • Infrastructure limitation: must associate with existing LANGID
    • 3rd-party:
      • IME: Yes
      • Voice/handwriting: No
extensible enablement56
Extensible enablement
  • Locales
    • Locale Builder (Beta 2)
      • Override existing locale / new custom locale
      • http://go.microsoft.com/fwlink/?LinkID=96654
      • Info: http://msdn.microsoft.com/en-us/magazine/cc163506.aspx
      • Infrastructure limitation: all custom locales share single LANGID
  • UI Language packs: not extensible
windows vista deployment
Windows Vista Deployment
  • Globalization scenarios
    • Create image with multiple language packs
      • WDS or other deployment tools
    • Create multilingual install point
    • Modify language settings in an image
    • Deploy a custom / replacement locale
windows vista deployment59
Windows Vista Deployment
  • Setup with multilingual image
windows vista deployment60
Windows Vista Deployment
  • Tools
    • Windows Automated Installation Kit (Windows AIK)

http://www.microsoft.com/downloads/details.aspx?FamilyID=993c567d-f12c-4676-917f-05d9de73ada4&displaylang=en

      • Package Manager: add / remove lang packs
      • Intlcfg.exe: modify int’l settings
      • Image Manager: create unattended-settings file
windows vista deployment61
Windows Vista Deployment
  • Create image with multiple language packs (WDS etc.)
    • Copy staged image (install.wim from sources folder) to local directory
    • Copy language packs (lp.cab from langpacks folder) to local directory
    • Mount image

imagex /mountrw c:\LP_Offline\Images\install.wim <imageId> c:\Mounted_Image

    • Remove language pack(s)

pkgmgr /a /up /m:c:\temp\en-US\lp.cab /o:c:\Mounted_Image;c:\Mounted_Image\Windows /l:c:\log-files\uninstall-en-US.log

    • Add language pack(s)

pkgmgr /a /ip /m:c:\lps\de-DE\lp.cab /o:c:\Mounted_Iimage;c:\Mounted_Image\Windows /l:c:\logs\install-de-DE.log

    • Regenerate lang.ini

intlcfg.exe –genlangini –image:c:\Mounted_Image –dist:c:\LP_Offline\Images

    • Unmount image and commit changes

imagex /unmount /commit c:\mounted_image

windows vista deployment62
Windows Vista Deployment

Create multilingual install point

  • Create folder for distribution

mkdir c:\windows_distribution

  • Copy media contents
  • Make folders for LPs in distribution and copy LPs

mkdir C:\windows_distribution\Langpacks\de-DE

copy d:\Langpacks\de-DE\lp.cab c:\windows_distribution\Langpacks\de-DE

  • Copy Setup resources, license files for lang packs

xcopy D:\Sources\de-DE\* c:\windows_distribution\Langpacks\de-DE /cherkyi

  • Mount image

imagex /mountrwc:\windows_distribution\Sources\install.wim <imageId>c:\Mounted_Image

  • Regenerate lang.ini

intlcfg.exe -genlangini -image:c:\Mounted_Image -dist:c:\windows_distribution –all:de-DE

  • Unmount image and commit changes

imagex /unmount /commit c:\mounted_image

windows vista deployment63
Windows Vista Deployment

Updating international settings

  • Offline image: use intlcfg.exe
    • Individual settings:
      • User locale
        • Also determines location
      • Input locale (language / layout)
      • System locale
      • UI language
      • UI language fallback
      • Time zone
    • -all:locale_name — sets to that locale (except time zone)
    • -skudefaults:language— sets as in MS SKU
windows vista deployment64
Windows Vista Deployment

Updating international settings

  • During setup: use Unattend.xml
    • Individual settings
      • UI language
      • Language fallback
      • User locale
      • System locale
      • Input locale
      • Time zone
    • WinPE, specialize, OOBE phases
windows vista deployment65
Windows Vista Deployment

<?xml version='1.0' encoding='utf-8'?>

<unattendxmlns="urn:schemas-microsoft-com:unattend" xmlns:ms="urn:schemas-microsoft-com:asm.v3">

<settings pass="specialize">

<component name="Microsoft-Windows-International-Core" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" processorArchitecture="x86">

<UILanguage>ar-AR</UILanguage>

<UILanguageFallback>fr-FR</UILanguageFallback>

<SystemLocale>ar-AR</SystemLocale>

<UserLocale>ar-AR</UserLocale>

<InputLocale>0401:00000401</InputLocale>

</component>

<component name="Microsoft-Windows-Shell-Setup" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" processorArchitecture="x86">

<TimeZone>ar-AR</TimeZone>

</component>

</settings>

</unattend>

windows vista deployment66
Windows Vista Deployment

Updating international settings

  • Customizing OOBE defaults: OOBE.xml
    • Just sets defaults; user still selects values
windows vista deployment67
Windows Vista Deployment
  • TechNet Resources
    • Deployment overview:

http://technet.microsoft.com/en-us/library/cc748937.aspx

    • Step-by-step guide:

http://technet.microsoft.com/en-us/library/cc766320.aspx

    • Step-by-step — language packs & int’l settings:

http://technet.microsoft.com/en-us/library/cc722391.aspx

windows vista deployment68
Windows Vista Deployment
  • Custom/replacement locales, custom keyboard layouts
    • Tools: Locale Builder / MS Keyboard Layout Creator
      • Can create .msi
      • No other features for network deployment
windows vista deployment69
Windows Vista Deployment
  • Language packs and servicing
    • GDRs/QFEs
      • Same GDR/QFE for all languages
      • If patch has resources, then is multilingual
        • most (~80%) have no resources
        • Smart: only downloads/installs languages needed
      • Adding new language packs
        • GDRs will be re-offered
        • Recommend to add LP before servicing
windows vista deployment70
Windows Vista Deployment
  • Language packs and servicing
    • Service Packs
      • Multilingual
        • SP1: 5-language versus all-language
          • English, French, German, Japanese, Spanish
          • Get the right package!
          • http://support.microsoft.com/kb/935791/
      • All LPs updated after SP
        • Can deploy updated LP before or after SP
globalization
Globalization
  • The ability of any feature to allow the customer to use, input, process, store, and output in any language, independent of the language and market of Windows.
why globalize
Why Globalize?
  • Providing local experiences
    • Individual users feel like the application was created just for them
    • Scale your application to new markets without hard-coding
  • Avoid usability problems
    • Sometimes a nuisance factor
      • E.g. month, day in wrong order
    • Other times a blocking issue
      • E.g. actually cannot read date (different language)
  • Consistency across the desktop user experience
    • User has a seamless experience across applications
use unicode
Use Unicode
  • Benefits
    • Don’t need to manage code pages to provide broad, multilingual functionality
    • Legacy code pages don’t cover the range of world languages
      • Many Unicode-only locales
      • Surrogate characters not supported in code pages

Use Unicode everywhere!

    • Not just interfaces; all the way through
use unicode75
Use Unicode
  • Using Unicode
    • Native code:
      • Don’t use “ANSI” API calls
      • “W” API calls: UTF-16
      • WCHAR, LPWSTR: explicit 16-bit

LPWSTR str = L"This is a Unicode string"

      • CRT: wcscmp, wcscpy_s
    • .Net: strings are Unicode by default
use unicode76
Use Unicode
  • Using Unicode
    • Conversion for code pages when necessary
      • Win32:
        • MultibyteToWideChar
        • WideCharToMultibyte
      • .Net: System.Text namespace
    • Conversion for Internationalized Domain Names
      • IdnToAscii
      • IdnToNameprepUnicode
      • IdnToUnicode
use unicode77
Use Unicode
  • Using Unicode
    • Diagnosing the problems
      • ???
      •  /  / 
      • gibberish
displaying multilingual text
Displaying multilingual text
  • Many operations involved
    • Characters to glyphs
      • Surrogates
      • Bidi
      • Shaping, cluster analysis
      • OpenType Layout (glyph transforms, positioning)
    • Rasterization
      • Low-res smoothing
displaying multilingual text79
Displaying multilingual text
  • Many operations involved
    • Measuring
      • Must consider complex-script behaviour
    • Hit-testing (mouse-click to string position)
    • Boundaries: line / word / cluster
    • Caret, selection
    • Font fallback
    • Justification, paragraph layout
displaying multilingual text80
Displaying multilingual text
  • Caveats
    • Don’t draw one character at a time
      • Filters, text effects: get outline of entire rendered string
    • Don’t assume non-negative “A”, “C” widths
    • Don’t assume width of string = sum(width of char i)
displaying multilingual text81
Displaying multilingual text
  • Caveats
    • Don’t assume words separated by space
    • Don’t assume order of characters = order of glyphs
    • Don’t assume characters:glyphs = 1
    • Don’t assume characters:cluster = 1
      • Don’t assume carat can go between any 2 characters
      • Don’t assume any character can be selected
    • Height of string may be greater than tmAscent – tmDescent
      • Can’t assume text never bleeds outsideclipping rectangle
displaying multilingual text82
Displaying multilingual text
  • Native APIs
    • ExtTextOut
    • DrawText
    • User controls (Edit, List, etc.)

hwndEdit = CreateWindow("EDIT", NULL, WS_CHILD|… );

Edit_SetText() / SetWindowText()

    • RichEdit control
      • Use MSFTEDIT_CLASS (msftedit.dll)
    • Common controls (comctl32.dll)

hwndEdit = CreateWindow("WC_EDIT", NULL, WS_CHILD|… );

displaying multilingual text83
Displaying multilingual text
  • Native APIs
    • Uniscribe
      • ScriptStringAnalyse: high-level API used by standard Win32 APIs, controls
      • Also several low-level APIs
    • GDI+
      • Font, Graphics.DrawString
      • Distinct text stack from GDI, not as extensive script support
displaying multilingual text84
Displaying multilingual text
  • Native APIs
    • Broad script support: all supported scripts
    • Much done for free — if used correctly
      • Bidi, shaping & glyph transforms
        • Default OpenType features (e.g. ligatures) automatically applied, but not for some scripts in ETO, RichEdit
      • Rasterization, smoothing
      • Font fallback
        • Not in Uniscribe low-level APIs
        • RichEdit has different logic than other controls, APIs
displaying multilingual text85
Displaying multilingual text
  • Native APIs
    • Much done for free (con’t)
      • Hit testing, measuring
      • Boundaries
        • Clusters
        • Basic word-stop, line-breaking
          • Thai dictionary, not for Khmer, Lao, …
displaying multilingual text86
Displaying multilingual text
  • Native APIs
    • Points to note
      • Algorithms that measure to find line-break opportunities: beware of performance!
        • Excessive calls to shape text can result in severe perf hit
      • GDI LOGFONT: lfCharset
        • Legacy, related to code page
        • ANSI_CHARSET = cp1252
        • Use DEFAULT_CHARSET
languages and locales
Languages and locales
  • Multiple concepts
    • UI language
      • Per-user default, fallback preferences
      • Thread default, fallback preferences
    • Input locale
      • Language + keyboard-layout / input-method ID
      • Set of enabled input locales per user
      • Active input locale, per thread
    • User locale — user’s default locale for formats, sorting, etc.
languages and locales88
Languages and locales
  • Multiple concepts
    • Thread locale — current thread locale for formats…
      • Defaults to user’s setting
      • Alternate can be set programmatically
    • System locale
      • System-wide setting
      • Main purpose: code page for legacy applications
    • Location — user’s location (GeoID)

APIs to obtain values for each concept

    • Make sure to use the appropriate one!
languages and locales89
Languages and locales
  • LCIDs / LANGIDs versus locale name IDs
    • Original Win32: LCIDs, LANGIDs
      • LCID: 32-bit, numeric locale ID
        • E.g. 0x0409 = English (U.S.)
      • LANGID: 16-bit, numeric ID
        • Locale minus sort variations
    • .Net: CultureInfo
      • CultureInfo.Name: string IDs
        • E.g. “en-US”
        • Region-neutral cultures — e.g. “en”
    • Win-32 in Vista: introducing SName (string IDs)
languages and locales90
Languages and locales
  • Numeric values that represent sets of locale data (e.g. 0409 is English – United States)
  • String-based values that allow for more transparent and predictable labeling of locale data (e.g. en-US is English – United States)
languages and locales91
Languages and locales
  • Use locale name, not LCID / LANGID
    • IETF compliant
    • Interoperability
    • Pick up user-defined custom locales
    • Pick up new Windows functionality over time
    • All LCID-based APIs have equivalent name-based support in Vista
  • Existing gaps
    • Input locales still expressed only in terms of LCIDs
keyboard input
Keyboard input
  • Caveats
    • Don’t assume only one language
      • User may have several languages enabled for input and switch between them
    • Don’t assume one keyboard layout
      • VK_A is not always “A”
      • Not every keyboard supports VK_n
      • Not every keyboard supports every character
    • Don’t assume one character on every keystroke
      • Use KeyPress event, not KeyUp / KeyDown
keyboard input93
Keyboard input
  • Caveats
    • Not all keyboard hardware have the same keys
      • Application shortcuts
    • Microsoft Keyboard Layout Creator
      • User can create completely custom layout
      • No limits on what characters will be input
      • May step on top of your application shortcuts
keyboard input94
Keyboard input
  • Win32
    • Input locale — HKL
      • 32-bit integer combining LANGID and numeric input-method ID
        • Infrastructure limitation: only part of infrastructure in Vista not using string IDs
      • APIs
        • GetKeyboardLayoutList() — enabled ILs for user
        • GetKeyboardLayout() — active IL for thread
        • WM_INPUTLANGCHANGEREQUEST, WM_INPUTLANGCHANGE — active IL for window changing
        • ActivateKeyboardLayout() — set active IL for thread
keyboard input95
Keyboard input
  • Win32
    • Get input characters
      • WM_CHAR, WM_UNICHAR — key-press event
      • But… IMEs, non-keyboard input-methods more complex
      • Text Services Framework
    • Recommendation: use provided controls
      • Handle all lower-level input interactions, including IME
locales
Locales
  • Combine multiple dimensions

Locale data

locales97
Locales
  • Locale data contain many kinds of information
locales98
Locales
  • Locale data: useful for
    • Date formats
    • Time formats
    • Number formats
    • Currency formats
    • Sorting
    • All kinds of user experiences where a customer’s cultural preferences matter
  • Location: useful for
    • Region-specific content that you’d like to make available
    • Aspects of user experience that are culture-specific but not linguistic in nature
locales99
Locales
  • Rely on locale data to help create globalized experience
locales100
Locales
  • Win32 APIs (sampling):
    • Enumerate available choices
      • EnumSystemLocalesEx() — get list of installed / supported locales on current system
      • EnumSystemGeoID() — get list of supported GeoIDs on current system
    • Get settings
      • GetUserDefaultLocaleName() — user’s default locale
      • GetThreadLocale() — active locale set on thread
locales101
Locales
  • Win32 APIs (sampling):
    • Set settings
      • SetThreadLocale() — set active locale on thread
    • Get particular data
      • GetLocaleInfoEx() — get particular details for a given locale
      • GetCalendarInfoEx() — get particular details for a given calendar
    • Formatting
      • GetDateFormatEx() — format numeric date as a date string using conventions for a certain culture
locales collation
Locales — Collation
  • Users expect lists of strings to come in some predictable order
    • Preferences vary by language and culture
      • “ll” in English vs. Spanish
      • “I” vs. “i” vs. “İ” vs. “ı” (cf. Turkish)
    • Users only know something is wrong when they can’t find something they expect to be there
  • Machines expect lists of strings to come in some particular order
    • Whatever order was assumed when list was first made will be expected later too
locales collation103
Locales — Collation
  • Binary vs. linguistically-appropriate: when to use which?
    • “Y” (U+0059) vs. “y” (U+0079) vs. “ʏ” (U+028F)
    • Ordering vs. Ordinal (identity)
      • Which comes first? vs. Is that the same one?
    • Use linguistically-appropriate sorting for strings ordered to present to users
    • Use binary sorting when building indexes and want stability in behaviour over time
locales collation104
Locales — Collation
  • Binary vs. linguistically-appropriate: one comparison
locales105
Locales
  • Caveats
    • Don’t hard-code particular conventions
      • E.g. don’t assume particular currency
    • Use globalized behaviour for presentation… but not for machine-readable values
      • Localized presentation
      • Locale-neutral concept, locale-neutral representation in storage, inter-process communication, etc.
locales106
Locales
  • Caveats
    • Things change!
      • Countries merge, split apart, join EU…
      • Governments declare new official languages
      • Government change official names of countries, languages
      • Languages are written in new writing system
      • New calendar systems are legislated
      • New currencies or currency symbols are adopted
    • Don’t hard-code identifiers
    • Don’t assume particular culture-specific data values
    • Things in the world really do change!
locales107
Locales
  • Caveats
    • User-level, things can change!
      • Regional and Language Options control panel: user can customize formats
        • If user overrides a value in a locale but then changes locale, customization is lost
      • Microsoft Locale Builder
        • Modify existing locales
        • Create new custom locales — e.g. English (Japan), Ojibwa (Canada)
      • Certain things can’t be changed
        • Default code page for existing locale
        • Default sort for existing locale
        • Month / day strings in non-Gregorian calendars
locales108
Locales
  • Final thoughts: Don’t roll your own!
    • We have platform APIs so that developers never need to think about geopolitically sensitive data.
    • We service our data so you don’t have to.
    • Don’t create your own solutions – it’s expensive and not scalable.
    • If there’s something you need and we don’t provide it, let us know.
globalizaton dos and don ts
Globalizaton: DOs and DON’Ts
  • DO use Unicode
  • DON’T store data in any legacy code page
  • DO expect any kind of character
  • DON’T expect a specific character to be there
  • DO use platform controls
  • DON’T assume one character = 1 cluster = 1 glyph
  • DO draw / measure entire strings
  • DON’T use LCIDs
  • DO use culture names
  • DON’T ignore user preferences
  • DO use appropriate string comparisons
mui what and why
MUI: What and Why
  • Past practice
    • English-then-re-engineered-localization development
      • Forked sources
      • Costly development
      • Multiple binary images to develop, deploy, service
      • Inflexible, single-language product

Goals

    • Reduce cost of developing, deploying, servicing
    • Reduced costs, greater flexibility for customers
mui what and why112
MUI: What and Why
  • Multilingual User Interface
    • Single world-wide binary / satellite-resource model
      • Single sources, build process, binary image to manage / maintain
    • Multilingual UI options, configuration-driven
      • Simpler, more flexible for customers

MUI in Windows

    • Evolving since Windows 2000
    • Vista: fully attained SWWB / satellite resources
mui how it works
MUI: How it works
  • Windows UI-language settings
    • System-default UI language
    • System-preferred UI language
    • User-preferred UI language
      • System / user settings must be installed, system languages
    • Thread UI languages
      • Up to 4 application languages
      • Application UI language need not be installed as system languages
mui how it works114
MUI: How it works
  • UI Language Fallback list
    • Fall-back order
      • Per-thread UI language
      • User-preferred UI language
      • System-preferred UI language
      • System-default UI language
    • Resource loader automatically manages resource satellites
      • Search satellites for resource in order
      • Partial localization supported
        • LIP + base language
mui applications
MUI Applications
  • A properly-globalized application that
    • Separates localized resources into separate, inter-changeable packages
    • Can have multiple language packages installed and in use
    • Follows system- / user-configuration settings and fallback behaviour whenever possible
developing win32 mui apps
Developing Win32 MUI Apps
  • Some considerations
    • Best user experience: consistent language throughout — within app, across apps/OS
    • Best practice:
      • Plan translation of resources carefully
      • Package code, localizable resources separately
      • Load resources according to OS UI language settings
      • Deploy cleanly on multilingual systems
developing win32 mui apps117
Developing Win32 MUI Apps
  • Resource technologies
    • Windows MUI assumes use of Win32 resources
      • Proprietary resources: follow system’s fallback list by calling GetThreadPreferredUILanguage()
    • Common resource technologies in Windows include:
      • Win32
      • Registry strings
      • Shell strings
      • Help files
      • Windows Event Log
      • Group Policy
      • WMI
      • MFC resource DLLs
developing win32 mui apps118
Developing Win32 MUI Apps
  • Resource models

Single-language

Multi-language

Satellite

Code

Code

Code

Resources (ja-JP)

Resources (en-US)

Language neutral file

Resources (ja-JP)

Resources (en-US)

Resources (ja-JP)

developing win32 mui apps119
Developing Win32 MUI Apps
  • Store localizable resources in satellite .mui files
    • Use .rc files as before
    • Use XML Resource Configuration (RC Config) file to specify which resources are to be stored in .mui file
    • Use updated RC compiler or MUIRCT to generate .mui files
    • Install .mui files using MUI naming conventions

<install dir>\foo.exe

<install dir>\en-US\foo.exe.mui

<install dir>\ja-JP\foo.exe.mui

developing win32 mui apps120
Developing Win32 MUI Apps
  • RC Config example

<?xml version="1.0" encoding="utf-8"?>

<localization>

<resources>

<win32Resources fileType="Application">

<neutralResources>

<resourceTypetypeNameId="#16" />

</neutralResources>

<localizedResources>

<resourceTypetypeNameId="#2" itemId="5 6 7 8 9 10 11 12“itemName="HTML PRI" />

<resourceTypetypeNameId="#4" />

<resourceTypetypeNameId="#16" />

</localizedResources>

</win32Resources >

</resources>

</localization>

developing win32 mui apps121
Developing Win32 MUI Apps
  • Workflow: localize source (.rc) versus localize PE (.exe)
    • Source localization:
      • Localize .rc files
      • Generate MUI file:
        • Build .mui with RC compiler, or
        • Build PE and use MUIRCT to split off .mui from lang-neutral PE
    • PE file localization:
      • Build en PE and use MUIRCT to split off .mui from lang-neutral PE
      • Localize .mui file
developing win32 mui apps122
Developing Win32 MUI Apps
  • Workflow: source localization, RC compiler

Compiler

Compiled .OBJ file

Source code

Linker

LN PE file

(foo.exe)

Localization

.RC files

Compiled LN resources

.RC files

Localized .RC files

RC.exe

Linker

RC Config file

Compiled Localized resources

MUI files

(foo.exe.mui)

developing win32 mui apps123
Developing Win32 MUI Apps
  • Workflow: source localization, MUIRCT

Source code

Compiler

& Linker

Executable (foo.exe)

LN PE File (foo.exe)

MUIRCT.exe

Localization

.RC file

RC Config file

MUI file (foo.exe.mui)

developing win32 mui apps124
Developing Win32 MUI Apps
  • Workflow: PE localization, MUIRCT

Source code

Compiler

& Linker

Executable (foo.exe)

LN PE File (foo.exe)

MUIRCT.exe

.RC file

Localization

RC Config file

MUI file (foo.exe.mui)

developing win32 mui apps125
Developing Win32 MUI Apps
  • Loading Win32 resources
    • MUI support is handled transparently
      • To set application-specific language, use SetThreadPreferredUILanguages()
      • Use existing resource-loading API calls without specifying language
      • Use the language-neutral executable as the module name (not the .mui file)
developing win32 mui apps126
Developing Win32 MUI Apps
  • Registry strings:
    • Don’t store localizable strings in registry — move to a resource file
    • Replace with language-neutral redirection strings of form “@<res binary>,-<res ID>”
      • E.g. “@tzres.dll,-161”
    • Call RegLoadMUIString()
      • Redirection string parsed, resource loaded transparently
      • Don’t call RegGetValue()!
developing win32 mui apps127
Developing Win32 MUI Apps
  • Pre-Vista Windows: Win2000/XP/Server2003
    • Down-level resource loader does not support Vista .mui files
      • LANGID vs. language names
    • Muiload.lib (Windows SDK)
      • Use LoadMUILibrary() / FreeMUILibrary()
      • Returns handle to appropriate language-specific resources
heading
Heading
  • Level 0
    • Level 1
      • Level 2
        • Level 3