Presentation is loading. Please wait.

Presentation is loading. Please wait.

Developing World-Ready Applications for Windows 2000/XP Houman Pournasseh Lead Program Manager Russ Rolfe Program Manager Windows Division.

Similar presentations


Presentation on theme: "Developing World-Ready Applications for Windows 2000/XP Houman Pournasseh Lead Program Manager Russ Rolfe Program Manager Windows Division."— Presentation transcript:

1 Developing World-Ready Applications for Windows 2000/XP Houman Pournasseh Lead Program Manager Russ Rolfe Program Manager Windows Division

2 Agenda Definitions Definitions Why invest in World-Ready products? Why invest in World-Ready products? Globalization – step-by-step Globalization – step-by-step Universal encoding - Unicode Universal encoding - Unicode Locale aware Locale aware Handle different input methods Handle different input methods Complex script aware Complex script aware Font independency Font independency Multi-lingual UI aware Multi-lingual UI aware Mirroring aware Mirroring aware Localizability Localizability Conclusion & References Conclusion & References

3 Agenda Definitions Definitions Why invest in World-Ready products? Why invest in World-Ready products? Globalization – step-by-step Globalization – step-by-step Universal encoding - Unicode Universal encoding - Unicode Locale aware Locale aware Handle different input methods Handle different input methods Complex script aware Complex script aware Font independency Font independency Multi-lingual UI aware Multi-lingual UI aware Mirroring aware Mirroring aware Localizability Localizability Conclusion & References Conclusion & References

4 Definitions World-Ready: Properly globalized and localizable. World-Ready: Properly globalized and localizable. Globalization: The process of designing and implementing source code so that it can accommodate any local market (locale) or script. Globalization: The process of designing and implementing source code so that it can accommodate any local market (locale) or script. Localizability: Designing software code and resources such that resources can be localized for any local market (locale) without changing the source code. Localizability: Designing software code and resources such that resources can be localized for any local market (locale) without changing the source code. Localization: The process of adapting a product (including both text and non-text elements) to meet the language, cultural, and political expectations and/or requirements of a specific local market (locale). Localization: The process of adapting a product (including both text and non-text elements) to meet the language, cultural, and political expectations and/or requirements of a specific local market (locale).

5 Users and Locales: To define their geographical location, users set the location To define formatting for date, time…, users set the user locale To run legacy applications (non- Unicode), users set the system locale To enter text in different languages, users set the input locale To select a UI language, users set the UI language

6 Windows XP International Enhancements Nine (9) new locales added to previous list of 126. Nine (9) new locales added to previous list of 126. Punjabi, Gujarati, Telugu, Kannada, Kyrgyz, Mongolian (Cyrillic), Galician, Divehi, Syriac Punjabi, Gujarati, Telugu, Kannada, Kyrgyz, Mongolian (Cyrillic), Galician, Divehi, Syriac New Indic and Arabic scripts New Indic and Arabic scripts Gujarati, Gurmukhi, Telugu, Kannada, Syriac, Divehi Gujarati, Gurmukhi, Telugu, Kannada, Syriac, Divehi More robust font display for East Asian languages. More robust font display for East Asian languages. Improved Regional Settings options. Improved Regional Settings options. Largely improved MUI support Largely improved MUI support New location (GEO) New location (GEO) Support for GB18030 Support for GB18030

7 Agenda Definitions Definitions Why invest in World-Ready products? Why invest in World-Ready products? Globalization – step-by-step Globalization – step-by-step Universal encoding - Unicode Universal encoding - Unicode Locale aware Locale aware Handle different input methods Handle different input methods Complex script aware Complex script aware Font independency Font independency Multi-lingual UI aware Multi-lingual UI aware Mirroring aware Mirroring aware Localizability Localizability Conclusion & References Conclusion & References

8 Why invest in World Ready products? Get into international market (World Wide Web era) Get into international market (World Wide Web era) Create a single functionality binary to: Create a single functionality binary to: Reduce development effort and cost Reduce development effort and cost Ease support and maintenance pain Ease support and maintenance pain

9 Why invest in World Ready products? Sim-Ship all language versions at once saves lost revenue. Sim-Ship all language versions at once saves lost revenue. English Dev Team German Loc Team JanFebMarAprMayJunJulAugSep Release Eng Ver 1.0 Release Ger Ver 1.0 Release Ger Ver 1.1 Release Eng Ver 1.1

10 Agenda Definitions Definitions Why invest in World-Ready products? Why invest in World-Ready products? Globalization – step-by-step Globalization – step-by-step Universal encoding - Unicode Universal encoding - Unicode Locale aware Locale aware Handle different input methods Handle different input methods Complex script aware Complex script aware Font independency Font independency Multi-lingual UI aware Multi-lingual UI aware Mirroring aware Mirroring aware Localizability Localizability Conclusion & References Conclusion & References

11 Transforms of Unicode UTF-7: 7 bit transformation format, seldom used UTF-7: 7 bit transformation format, seldom used UTF-8 UTF-8 8 bit transformation format 8 bit transformation format For transmission over unknown lines: e.g. Web pages For transmission over unknown lines: e.g. Web pages Codepage number CP_UTF8 = Codepage number CP_UTF8 = UTF-16 and UCS-2 UTF-16 and UCS-2 Microsoft uses UTF-16 little-endian as its standard for Unicode encoding Microsoft uses UTF-16 little-endian as its standard for Unicode encoding UTF-32 and UCS-4 UTF-32 and UCS-4

12 Windows 2000/XP: Unicode & Single Binary Built in support for hundreds of languages Built in support for hundreds of languages Any (well behaved) language Win32 application can run on any language version of Windows 2000/XP Any (well behaved) language Win32 application can run on any language version of Windows 2000/XP Native Unicode support for new scripts Native Unicode support for new scripts Support for supplementary characters Support for supplementary characters

13 Unicode Encoding Non-Unicode applications behavior depends on users settings and makes data exchange between OS language versions impossible.

14 Legacy systems support Few exceptions for not fully Unicode apps: Few exceptions for not fully Unicode apps: App has to run on Win9x and NT App has to run on Win9x and NT Existing Internet protocols and standards require special encoding Existing Internet protocols and standards require special encoding Supporting apps that need to run on Win9x Supporting apps that need to run on Win9x Create two separate binaries: one ANSI & one Unicode Create two separate binaries: one ANSI & one Unicode Register as ANSI and internally convert to/from Unicode as needed Register as ANSI and internally convert to/from Unicode as needed Use MSLU! Use MSLU!

15 TCHAR LPTSTR wchar_t char wchar_t * char * For 8 bit and double-byte characters: For 8 bit and double-byte characters: typedef char CHAR; // 8 bit character typedef char *LPSTR; // pointer to 8 bit string For Unicode (Wide) characters: For Unicode (Wide) characters: typedef unsigned short WCHAR; // 16 bit character typedef WCHAR *LPWSTR; //pointer to 16 bit string Data types

16 Win32 API prototypes Generic function prototypes: Generic function prototypes: // winuser.h #ifdef UNICODE #define SetWindowText SetWindowTextW #else #define SetWindowText SetWindowTextA #endif // UNICODE A routines behavior under Windows 2000/XP A routines behavior under Windows 2000/XP W routines behavior under Win9x W routines behavior under Win9x

17 String manipulation functions and macros Generic CRT 8 bit codepage Unicode _tcscpystrcpywcscpy _tcscmpstrcmpwcscmp Generic Win32 8 bit codepage Unicode lstrcpylstrcpyAlstrcpyW lstrcmplstrcmpAlstrcmpW Compile with –D_UNICODE to get Unicode version Compile with –DUNICODE to get Unicode version #ifdef UNICODE #define TEXT(string) L#string #else #define TEXT(string) string #endif // UNICODE

18 Unicode ANSI Converting between ANSI and Unicode Converting between ANSI and Unicode MultiByteToWideChar for codepage Unicode MultiByteToWideChar for codepage Unicode WideCharToMultiByte for Unicode codepage WideCharToMultiByte for Unicode codepage CP can be any legal codepage number or a predefined such as: CP_ACP, CP_SYMBOL, CP_UTF8, etc. Tips for writing Unicode: Tips for writing Unicode: Use generic data types and function prototypes Use generic data types and function prototypes Replace p++/p-- with CharNext/CharPrev Replace p++/p-- with CharNext/CharPrev Compute buffer sizes in TCHAR Compute buffer sizes in TCHAR

19 Porting an ANSI application to Unicode

20 Encodings in Web pages ANSI codepages or ISO character encodings ANSI codepages or ISO character encodings Mono-lingual or restricted to one script Mono-lingual or restricted to one script Raw Unicode: UTF-16 Raw Unicode: UTF-16 OK for Windows NT networks OK for Windows NT networks Number entities: क Number entities: क OK for occasional use OK for occasional use UTF-8: Recommended encoding UTF-8: Recommended encoding Supported by IE 4.0+ and Netscape 4.0+ Supported by IE 4.0+ and Netscape 4.0+

21 Setting web encoding HTML/DHTML: HTML/DHTML: Tag in the head of the document "> "> XML: XML: ?> ?> ASP: ASP: Specify charset using ASP directives: Specify charset using ASP directives: Per session: Per session: %> %> Per page: Per page: %> %>

22 Setting encodings for.NET Class: System.Text Class: System.Text Distinction between: File, Request, and Response encodings Distinction between: File, Request, and Response encodings in code: in code: Response.ContentEncoding= Response.ContentEncoding= in page directive: in page directive: %> %> in configuration file: in configuration file: fileEncoding= />

23 Universally encoded page

24 Agenda Definitions Definitions Why invest in World-Ready products? Why invest in World-Ready products? Globalization – step-by-step Globalization – step-by-step Universal encoding - Unicode Universal encoding - Unicode Locale aware Locale aware Handle different input methods Handle different input methods Complex script aware Complex script aware Font independency Font independency Multi-lingual UI aware Multi-lingual UI aware Mirroring aware Mirroring aware Localizability Localizability Conclusion & References Conclusion & References

25 Windows 2000/XP: National Language Settings NLS APIs allow you to automatically adjust to users formatting preferences: NLS APIs allow you to automatically adjust to users formatting preferences: Date: 07/04/01 is in Japan Date: 07/04/01 is in Japan Time: 9:00PM is 21:00 in the France Time: 9:00PM is 21:00 in the France Currency: $1, is 1.000,00 $ in Germany Currency: $1, is 1.000,00 $ in Germany Large Numbers: 123,456, is 12,34,56, in Hindi Large Numbers: 123,456, is 12,34,56, in Hindi Sort Order: Germanä comes after a Swedishä comes after z Sort Order: Germanä comes after a Swedishä comes after z

26 Locale awareness Eliminate implicit locale assumptions from code: Eliminate implicit locale assumptions from code: #define ToUpper(ch) \ #define ToUpper(ch) \ ((ch)<='Z' ? (ch) : (ch)+'A' - 'a') Query system to format locale-dependent data using NLS APIs and LCIDs. Query system to format locale-dependent data using NLS APIs and LCIDs. 6 bits 10 bits4 bits12 bits Reserved Sub- language Sort ID Primary Language Language ID

27 NLS APIs Getting and setting locales Querying locales Querying locales LCID GetSystemDefaultLCID LCID GetSystemDefaultLCID EnumSystemLocales EnumSystemLocales LCID GetUserDefaultLCID() LCID GetUserDefaultLCID() LCID GetThreadLocale() LCID GetThreadLocale() Setting locales Setting locales BOOL SetThreadLocale(LCID dwNewLocale) BOOL SetThreadLocale(LCID dwNewLocale) BOOL SetLocaleInfo(LCID,…) // Works for standard locales only! BOOL SetLocaleInfo(LCID,…) // Works for standard locales only! No APIs to set System locale, User locale, and UI language No APIs to set System locale, User locale, and UI language

28 NLS APIs Querying locale information To retrieve information specific to a given locale: GetLocaleInfo To retrieve information specific to a given locale: GetLocaleInfo Gives information for any valid locale (takes an LCID). Gives information for any valid locale (takes an LCID). LCTYPE input tells type of info to retrieve for a given locale (e.g. currency symbol, name of months…). LCTYPE input tells type of info to retrieve for a given locale (e.g. currency symbol, name of months…). Returns info in string buffer (LPTSTR). Returns info in string buffer (LPTSTR). To retrieve information specific to a location: GetGeoInfo To retrieve information specific to a location: GetGeoInfo Gives information for any valid location (takes an LCID). Gives information for any valid location (takes an LCID). SYSGEOTYPE input tells type of info to retrieve for a given location(e.g. LCID, Time zones…). SYSGEOTYPE input tells type of info to retrieve for a given location(e.g. LCID, Time zones…).

29 NLS APIs Formatting data To enumerate formats: To enumerate formats: EnumCalendarInfo(Ex) EnumCalendarInfo(Ex) EnumDateFormats EnumDateFormats EnumTimeFormats EnumTimeFormats To format data directly: To format data directly: GetCurrencyFormat GetCurrencyFormat GetDateFormat GetDateFormat GetTimeFormat GetTimeFormat

30 A locale aware application

31 Locale awareness in web pages To retrieve user locale: To retrieve user locale: A server variable: A server variable:Request.ServerVariables("HTTP_ACCEPT_LANGUAGE") A property of the navigator object: A property of the navigator object:navigator.UserLanguage To set a locale: To set a locale: In DHTML: In DHTML:SetLocale("de") DateData = FormatDateTime(now(), vbShortDate) In ASP: In ASP:

32 Locale awareness in.NET Class: System.Globalization Class: System.Globalization Referenced as CultureInfo – set of preferences based on language and culture. Referenced as CultureInfo – set of preferences based on language and culture. Pattern: xx-XX, such as fr-CA, de-AT(RFC-1766) Setting the CultureInfo: Setting the CultureInfo: Implicit: Picked up from User Locale Implicit: Picked up from User Locale Explicit: Explicit: In code: Thread.CurrentThread.CurrentCulture = new CultureInfo (de-DE) In page directive: %> In config: />

33 Locale aware web site

34 Agenda Definitions Definitions Why invest in World-Ready products? Why invest in World-Ready products? Globalization – step-by-step Globalization – step-by-step Universal encoding - Unicode Universal encoding - Unicode Locale aware Locale aware Handle different input methods Handle different input methods Complex script aware Complex script aware Font independency Font independency Multi-lingual UI aware Multi-lingual UI aware Mirroring aware Mirroring aware Localizability Localizability Conclusion & References Conclusion & References

35 Handling Input methods Easiest: Using edit controls (recommended) Easiest: Using edit controls (recommended) Responding directly to user input Responding directly to user input Input locales (language + input method): HKL Input locales (language + input method): HKL GetKeyboardLayout GetKeyboardLayout ActivateKeyboardLayout ActivateKeyboardLayout LoadKeyboardLayout LoadKeyboardLayout Windows messages: Windows messages: WM_INPUTLANGCHANGEREQUEST WM_INPUTLANGCHANGEREQUEST WM_INPUTLANGCHANGE WM_INPUTLANGCHANGE WM_IME*.* (for IME support only) WM_IME*.* (for IME support only) WM_CHAR and WM_IME_CHAR WM_CHAR and WM_IME_CHAR

36 Agenda Definitions Definitions Why invest in World-Ready products? Why invest in World-Ready products? Globalization – step-by-step Globalization – step-by-step Universal encoding - Unicode Universal encoding - Unicode Locale aware Locale aware Handle different input methods Handle different input methods Complex script aware Complex script aware Font independency Font independency Multi-lingual UI aware Multi-lingual UI aware Mirroring aware Mirroring aware Localizability Localizability Conclusion & References Conclusion & References

37 Complex Scripts have one or more of the following attributes: Complex Scripts have one or more of the following attributes: Bi-directional (BiDi) reordering (Arabic, Hebrew) Bi-directional (BiDi) reordering (Arabic, Hebrew)reordering Contextual shaping (Arabic, Indic family) Contextual shaping (Arabic, Indic family) Contextual shaping Contextual shaping Display of combining characters (Arabic, Thai, Indic) Display of combining characters (Arabic, Thai, Indic)combining characters combining characters Specialized word-breaking (Thai) Specialized word-breaking (Thai) Text Justification (Arabic) Text Justification (Arabic)Justification Windows 2000/XP: Complex Scripts

38 Back Complex Scripts BiDi reordering

39 Back Complex Scripts Contextual Shaping

40 Back Complex Scripts Combining Characters

41 Back Complex Scripts Justification

42 Uniscribe Clients: Windows 2000/XP, Trident, Microsoft Office 2000/XP Clients: Windows 2000/XP, Trident, Microsoft Office 2000/XP A collection of exported APIs (high and low level) A collection of exported APIs (high and low level) Hides implementation details Hides implementation details A shaping engine per language A shaping engine per language USER GDI LPK. DLL USP Application

43 Options to display text Plain text in application Plain text in application Standard edit control or Standard edit control or Win32 API ( ExtTextOut / DrawText ). Win32 API ( ExtTextOut / DrawText ). Simple formatted text Simple formatted text In Win32 apps, use Richedit control. In Win32 apps, use Richedit control. For Web pages, use Document Object Model (DHTML). For Web pages, use Document Object Model (DHTML). Advanced formatting Advanced formatting Use Uniscribe (see SDK and MSJ article). Use Uniscribe (see SDK and MSJ article).

44 Special considerations When dealing with BiDi, set RTL reading order and alignment When dealing with BiDi, set RTL reading order and alignment SetTextAlign / GetTextAlign with TA_RIGHT SetTextAlign / GetTextAlign with TA_RIGHT ExtTextOut with ETO_RTLREADING ExtTextOut with ETO_RTLREADING DrawText with DT_RTLREADING DrawText with DT_RTLREADING To measure line lengths: To measure line lengths: Do not sum cached character widths Do not sum cached character widths Do use a GetTextExtent function or Uniscribe Do use a GetTextExtent function or Uniscribe When displaying typed text: When displaying typed text: Do not output characters one at a time! Do not output characters one at a time! Do save text in a buffer and display the whole string with Uniscribe or Win32 API Do save text in a buffer and display the whole string with Uniscribe or Win32 API

45 Agenda Definitions Definitions Why invest in World-Ready products? Why invest in World-Ready products? Globalization – step-by-step Globalization – step-by-step Universal encoding - Unicode Universal encoding - Unicode Locale aware Locale aware Handle different input methods Handle different input methods Complex script aware Complex script aware Font independency Font independency Multi-lingual UI aware Multi-lingual UI aware Mirroring aware Mirroring aware Localizability Localizability Conclusion & References Conclusion & References

46 Windows 2000/XP: Font support Introduction of OpenType fonts: Introduction of OpenType fonts: Extended TTF with glyphs for PE, ME, Thai, Greek, Turkish, Cyrillic … Extended TTF with glyphs for PE, ME, Thai, Greek, Turkish, Cyrillic … Font fallback mechanism for CS and Eastern Asian scripts used by Uniscribe Font fallback mechanism for CS and Eastern Asian scripts used by Uniscribe Font linking mechanism used by GDI Font linking mechanism used by GDI

47 Font independency Win32 programming Not to do: Not to do: Hard code font face names Hard code font face names Assume a given font is installed Assume a given font is installed Assume selected font supports the desired script Assume selected font supports the desired script To do: To do: Use MS Shell Dlg face name in Dialog resources Use MS Shell Dlg face name in Dialog resources EnumFontFamiliesEx or ChooseFont to select fonts EnumFontFamiliesEx or ChooseFont to select fonts

48 Font independency In Web pages Avoid placing text formatting values into in-line style. Avoid placing text formatting values into in-line style. Hello Hello Declare text style in CSS files: Declare text style in CSS files: Hello Hello Use WEFT to embed fonts to your web pages (IE only): Use WEFT to embed fonts to your web pages (IE only):

49 Agenda Definitions Definitions Why invest in World-Ready products? Why invest in World-Ready products? Globalization – step-by-step Globalization – step-by-step Universal encoding - Unicode Universal encoding - Unicode Locale aware Locale aware Handle different input methods Handle different input methods Complex script aware Complex script aware Font independency Font independency Multi-lingual UI aware Multi-lingual UI aware Mirroring aware Mirroring aware Localizability Localizability Conclusion & References Conclusion & References

50 Windows 2000/XP: Multilanguage UI Multilanguage version of Windows 2000/XP allows you to: Switch the language of UI without rebooting Switch the language of UI without rebooting Set the language of UI per user Set the language of UI per user Add/Remove language modules Add/Remove language modules Offer your own solution for a multilingual UI Offer your own solution for a multilingual UI

51 Multilingual UI Applications Possible options One localized.exe per target language One localized.exe per target language Eng.exeGer.exeJpn.exe Myapp.exeEng GerJpn Myapp.exeEng.dllGer.dllJpn.dll One multilingual language resource DLL One multilingual language resource DLL One resource DLL per target language

52 Satellite DLL Initialize to current UI language. Initialize to current UI language. Windows 2000/XP: GetUserDefaultUILanguage() Windows 2000/XP: GetUserDefaultUILanguage() Down-level platforms: See Writing Multilingual User Interface Applications on Globaldev. Down-level platforms: See Writing Multilingual User Interface Applications on Globaldev. Allow user to select UI language. Allow user to select UI language. Use naming convention, for example: res.dll Use naming convention, for example: res.dll Find all resource DLLs using FindFirstFile and FindNextFile Find all resource DLLs using FindFirstFile and FindNextFile Use LoadLibrary(Ex) to load DLL file Use LoadLibrary(Ex) to load DLL file

53 Agenda Definitions Definitions Why invest in World-Ready products? Why invest in World-Ready products? Globalization – step-by-step Globalization – step-by-step Universal encoding - Unicode Universal encoding - Unicode Locale aware Locale aware Handle different input methods Handle different input methods Complex script aware Complex script aware Font independency Font independency Multi-lingual UI aware Multi-lingual UI aware Mirroring aware Mirroring aware Localizability Localizability Conclusion & References Conclusion & References

54 Windows 2000/XP: Mirroring technology To create an automatic right-to-left layout of the user interface for localized versions of bidirectional languages (Arabic and Hebrew).

55 Coordinate transformation Origin (0,0) in upper RIGHT corner of window Origin (0,0) in upper RIGHT corner of window X scale factor = -1 X scale factor = -1 X values increase from right to left X values increase from right to left Default (LTR) window OriginOrigin Increasing x 01 Mirrored (RTL) window OriginOrigin Increasing x 01

56 Controlling the mirroring style Per Process: Per Process: GetProcessDefaultLayout GetProcessDefaultLayout SetProcessDefaultLayout (LAYOUT_RTL) SetProcessDefaultLayout (LAYOUT_RTL) Per window: Per window: CreateWindowEx (WS_EX_LAYOUTRTL | WS_EX_NOINHERITLAYOUT ) CreateWindowEx (WS_EX_LAYOUTRTL | WS_EX_NOINHERITLAYOUT ) SetWindowLong SetWindowLong Per DC: Per DC: GetLayout / SetLayout GetLayout / SetLayout LAYOUT_BITMAPORIENTATIONPRESERVED ; LAYOUT_BITMAPORIENTATIONPRESERVED ;

57 Controlling the mirroring style Dialog Resources: Dialog Resources: Set WS_EX_LAYOUTRTL in dialog template Set WS_EX_LAYOUTRTL in dialog template Message boxes: Message boxes: Use MB_RTLLAYOUT option Use MB_RTLLAYOUT option BitBlt/StretchBlt: BitBlt/StretchBlt: Use NOMIRRORBITMAP flag Use NOMIRRORBITMAP flag

58 Mirrored bitmap! Off screen bitblt Mirroring common issues

59 BiDi & mirroring in web pages In a web context, mirroring and RTL reading order go hand-in-hand: Using DIR attribute would: Using DIR attribute would: Set the right alignment of the text Set the right alignment of the text Set the right_to_left reading order of the text Set the right_to_left reading order of the text Mirror the page context Mirror the page context Leave the orientation of stationary elements Leave the orientation of stationary elements To set DIR attribute: To set DIR attribute: Html: Html: At an element level At an element level DHTML object: document.Dir = "RTL DHTML object: document.Dir = "RTL

60 Tips for BiDi web pages Directional images: Directional images: Avoid explicit alignments: Avoid explicit alignments: Obsolete usage of align=left in tables and cells Obsolete usage of align=left in tables and cells Avoid absolute positioning of elements Avoid absolute positioning of elements Remember: tables get mirrored automatically, use them for robust reversibility! Remember: tables get mirrored automatically, use them for robust reversibility!

61 Mirrored DHTML

62 Agenda Definitions Definitions Why invest in World-Ready products? Why invest in World-Ready products? Globalization – step-by-step Globalization – step-by-step Universal encoding - Unicode Universal encoding - Unicode Locale aware Locale aware Handle different input methods Handle different input methods Complex script aware Complex script aware Font independency Font independency Multi-lingual UI aware Multi-lingual UI aware Mirroring aware Mirroring aware Localizability Localizability Conclusion & References Conclusion & References

63 Localizability Localization of software: Adapting user interface elements to a specific language Localization of software: Adapting user interface elements to a specific language Localization should require no engineering changes! Localization should require no engineering changes! Changes to code are part of localizability process Changes to code are part of localizability process Source code changes, due to localization, are bugs in the core code! Source code changes, due to localization, are bugs in the core code!

64 Challenges Developers are focused on their primary language Developers are focused on their primary language Coding tricks to save work (saves a few $) Coding tricks to save work (saves a few $) Hardcoded strings Hardcoded strings Creating text strings from phrases by concatenation Creating text strings from phrases by concatenation Creates dialog boxes using overlapped controls Creates dialog boxes using overlapped controls The tricks cost lots of $ because: The tricks cost lots of $ because: Bugs difficult to detect before localization is done Bugs difficult to detect before localization is done Code change required to address the issue Code change required to address the issue

65 Unbreakable rules (1/3) Remove all localizable resources from source code, place in standard resource file Remove all localizable resources from source code, place in standard resource file Do not place non-localizable strings in resource file Do not place non-localizable strings in resource file

66 Avoid composite strings that are built at runtime: Avoid composite strings that are built at runtime: Wrong way: Wrong way: var t1_text = "Not enough memory to"; t2_text = "the file"; v1_text = "open"; v2_text = "copy"; v3_text = "save";... text = t1_text+" "+v2_text+" "+t2_text+" "+filename+"."; Right way Right way var t1_text = "Not enough memory to open the file %s1."; var t2_text = "Not enough memory to copy the file %s1."; var t3_text = "Not enough memory to save the file %s1."; Use FormatMessage for multiple variable sentences Use FormatMessage for multiple variable sentences Thus: Thus: "Not enough memory to %s1 the file %s2."; Becomes: Becomes: Liian vähän muistia tiedoston %2 %1.: Unbreakable rules (2/3)

67 Unbreakable rules (3/3) Do not reuse string resources: Do not reuse string resources: If the same string resource is to be used in more than one place, create one instance of the resource per use If the same string resource is to be used in more than one place, create one instance of the resource per use Use the same resource identifiers throughout the life of a product Use the same resource identifiers throughout the life of a product

68 Rule of thumb: < 10 = 300%< 10 = 300% > 10 = 30%> 10 = 30% Text Expansion Allow for text expansion

69 Text Expansion (web pages) Design so Entire Dialog Consists of Tables: Design so Entire Dialog Consists of Tables: Avoid Fixed Width Items Avoid Fixed Width Items Each Control Should be in a Separate Cell Each Control Should be in a Separate Cell Allow Text Wrapping - do not use nowrap Allow Text Wrapping - do not use nowrap Separate Check Boxes and Radio Buttons from Labels Separate Check Boxes and Radio Buttons from Labels

70 Text Expansion HTML Dialogs

71 Mirroring HTML Dialogs

72 Localizability Pseudo-Localization is a good way to test Localizability Pseudo-Localization is a good way to test Localizability

73 Agenda Definitions Definitions Why invest in World-Ready products? Why invest in World-Ready products? Globalization – step-by-step Globalization – step-by-step Universal encoding - Unicode Universal encoding - Unicode Locale aware Locale aware Handle different input methods Handle different input methods Complex script aware Complex script aware Font independency Font independency Multi-lingual UI aware Multi-lingual UI aware Mirroring aware Mirroring aware Localizability Localizability Conclusion & References Conclusion & References

74 Final Conclusions Benefits of investing in development of World- Ready applications are real Benefits of investing in development of World- Ready applications are real Windows 2000/XP eases the pain and sets the standard Windows 2000/XP eases the pain and sets the standard The biggest task in implementing World-Ready applications is setting the designers and engineers mind-set to think GLOBAL The biggest task in implementing World-Ready applications is setting the designers and engineers mind-set to think GLOBAL

75 MSDN for latest documentation about new APIs MSDN for latest documentation about new APIs Developing International Software for Windows 95 and Windows NT Developing International Software for Windows 95 and Windows NT Windows 2000/XP Globalization: Windows 2000/XP Globalization: World-Ready Guide World-Ready Guide You are not World-Ready If… You are not World-Ready If… aliases: aliases:

76


Download ppt "Developing World-Ready Applications for Windows 2000/XP Houman Pournasseh Lead Program Manager Russ Rolfe Program Manager Windows Division."

Similar presentations


Ads by Google