developing international software when a localized software fails

26
Developing Developing International International Software Software When a localized software When a localized software fails fails

Upload: beverly-heath

Post on 30-Dec-2015

229 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Developing International Software When a localized software fails

Developing Developing International International

SoftwareSoftwareWhen a localized software When a localized software

failsfails

Page 2: Developing International Software When a localized software fails

The basic application WORDPADThe basic application WORDPAD New features for WORDPADNew features for WORDPAD Implementing the new featuresImplementing the new features Testing WORDPADTesting WORDPAD Localizing WORDPADLocalizing WORDPAD Reviewing the i18n programming errorsReviewing the i18n programming errors Localizing fixed WORDPADLocalizing fixed WORDPAD Testing fixed WORDPADTesting fixed WORDPAD More i18n issuesMore i18n issues

Page 3: Developing International Software When a localized software fails

The Basic Application The Basic Application WORDPADWORDPAD

A sample application for developers A sample application for developers provided by Microsoft – including provided by Microsoft – including source codesource code

WORDPAD is a small text-editor WORDPAD is a small text-editor Developed using C++Developed using C++ Uses Windows Resource Scripts to Uses Windows Resource Scripts to

store localizable datastore localizable dataStart WORDPAD

Page 4: Developing International Software When a localized software fails

New Features for New Features for WORDPADWORDPAD

Map selected text to upper-caseMap selected text to upper-case Map selected text to lower-caseMap selected text to lower-case Reverse selected text (our job!)Reverse selected text (our job!) Display statistics about selected text, Display statistics about selected text,

like alphabetical characters, like alphabetical characters, numerical characters, white spaces,…numerical characters, white spaces,…

Display a dialog with a preview of to-Display a dialog with a preview of to-upper, to-lower and reverse upper, to-lower and reverse

Page 5: Developing International Software When a localized software fails

Implementing the New Implementing the New Features Features

Start the Developer StudioStart the Developer Studio Open the WORDPAD project in Open the WORDPAD project in

directory "Wordpad Start"directory "Wordpad Start" Compile and run the applicationCompile and run the application Implement Implement

"OnLocalizationtestReverse" in "OnLocalizationtestReverse" in module "mainfrm.cpp"module "mainfrm.cpp"

Start DevStudio

Page 6: Developing International Software When a localized software fails

Testing WORDPADTesting WORDPAD(The Programmers View)(The Programmers View)

Testing WORDPAD with "test.rtf" Testing WORDPAD with "test.rtf" in directory "Wordpad Start" or in directory "Wordpad Start" or

"Wordpad implemented""Wordpad implemented" Your test results and my test resultsYour test results and my test results Fixing the programming errorFixing the programming error

Start DevStudio

Start WORDPAD

Page 7: Developing International Software When a localized software fails

Localizing WORDPADLocalizing WORDPAD Testing WORDPAD (Localizers View)Testing WORDPAD (Localizers View)

Open PASSOLO with project "Wordpad" in Open PASSOLO with project "Wordpad" in directory "Wordpad Start" or "Wordpad directory "Wordpad Start" or "Wordpad implemented"implemented"

Use Pseudo-TranslationUse Pseudo-Translation Your test results and my test resultsYour test results and my test results 128-137) 128-137)

Localizing WORDPADLocalizing WORDPAD Open PASSOLO with project "Wordpad" in Open PASSOLO with project "Wordpad" in

directory "Wordpad Start" or "Wordpad directory "Wordpad Start" or "Wordpad implemented"implemented"

Dialog "Preview of Text Modification Functions"Dialog "Preview of Text Modification Functions" StringTable ID's 193 to 199StringTable ID's 193 to 199

Start PASSOLO

Page 8: Developing International Software When a localized software fails

Reviewing the i18n Reviewing the i18n programming errorsprogramming errors

Open the WORDPAD project in directory Open the WORDPAD project in directory "Wordpad Start" or "Wordpad "Wordpad Start" or "Wordpad implemented" implemented"

Fix error in "OnLocalizationtestReverse“Fix error in "OnLocalizationtestReverse“ Move error message to StringTableMove error message to StringTable Load error message from StringTableLoad error message from StringTable

Reviewing other code in module Reviewing other code in module "mainfrm.cpp""mainfrm.cpp"

Reviewing module "TextPreview.cpp" Reviewing module "TextPreview.cpp" Start DevStudio

Page 9: Developing International Software When a localized software fails

void CMainFrame::OnLocalizationtestReverse() { CRichEditView *pView = (CRichEditView *) GetActiveView(); if (pView->GetRichEditCtrl().GetSelectionType() & (SEL_OBJECT | SEL_MULTIOBJECT )) { // PASSOLO: Hardcoded, cannot be localized! AfxMessageBox(L"Cannot reverse text because selection contains embedded objects!", MB_OK); return; }

CString str = pView->GetRichEditCtrl().GetSelText(); str.MakeReverse(); pView->GetRichEditCtrl().ReplaceSel((LPCTSTR) str);}

void CMainFrame::OnLocalizationtestReverse() { CRichEditView *pView = (CRichEditView *) GetActiveView(); if (pView->GetRichEditCtrl().GetSelectionType() & (SEL_OBJECT | SEL_MULTIOBJECT )) { // PASSOLO: Moved message to string table AfxMessageBox(IDS_NOTREVERSE, MB_OK); return; }

CString str = pView->GetRichEditCtrl().GetSelText(); str.MakeReverse(); pView->GetRichEditCtrl().ReplaceSel((LPCTSTR) str);}

Resources:STRINGTABLE DISCARDABLE BEGIN IDS_NOTREVERSE "Cannot reverse text because selection contains one or more embedded objects!" IDS_LESS50 "Selection contains less than 50 characters" IDS_MORE50 "Selection contains 50 or more characters" IDS_NOQUOTES "Cannot add quotes to text because selection contains one or more embedded objects!"END

Page 10: Developing International Software When a localized software fails

void CMainFrame::OnLocalizationtestTolower() { CRichEditView *pView = (CRichEditView *) GetActiveView(); if (pView->GetRichEditCtrl().GetSelectionType() & (SEL_OBJECT | SEL_MULTIOBJECT )) { // A little artifical sequence but things like this happen! CString str; TCHAR buffer[100]; str.LoadString(IDS_NOTOLOWER);

// If message is longer than 100 characters stack will be overwritten _tcscpy(buffer, (LPCTSTR) str); AfxMessageBox(buffer, MB_OK | MB_ICONINFORMATION); return; } CString str = pView->GetRichEditCtrl().GetSelText(); str.MakeLower(); pView->GetRichEditCtrl().ReplaceSel((LPCTSTR) str);}

void CMainFrame::OnLocalizationtestTolower() { CRichEditView *pView = (CRichEditView *) GetActiveView(); if (pView->GetRichEditCtrl().GetSelectionType() & (SEL_OBJECT | SEL_MULTIOBJECT )) { // PASSOLO: More spaces for translated message! CString str; TCHAR buffer[200]; str.LoadString(IDS_NOTOLOWER);

// PASSOLO: Limit the max number of chars copied _tcsncpy(buffer, (LPCTSTR) str, DIMOF(buffer)); buffer[DIMOF(buffer) - 1] = 0; AfxMessageBox(buffer, MB_OK | MB_ICONINFORMATION); return; } CString str = pView->GetRichEditCtrl().GetSelText(); str.MakeLower(); pView->GetRichEditCtrl().ReplaceSel((LPCTSTR) str);}

Page 11: Developing International Software When a localized software fails

void CTextPreview::OnRadio3() { USES_CONVERSION;

if (CurrentOption == IDC_RADIO3) return; this->CheckRadioButton(IDC_RADIO1, IDC_RADIO3, IDC_RADIO3); CurrentOption = IDC_RADIO3;

// This is a Unicode application, so using ANSI API is artificial but this // is the kind of function being used in a lot of application and causing // a lot of troubles. // Also static buffer size can be problem! char buffer[100]; LoadStringA(theApp.m_hInstance, IDS_SAMLPETEXT, buffer, sizeof(buffer)); m_Current = A2CW(buffer); SetData(); UpdateData(FALSE); }

void CTextPreview::OnRadio3() { USES_CONVERSION;

if (CurrentOption == IDC_RADIO3) return; this->CheckRadioButton(IDC_RADIO1, IDC_RADIO3, IDC_RADIO3); CurrentOption = IDC_RADIO3;

// PASSOLO: Luckily the application is Unicode, no need to loose character information CString str; str.LoadString(IDS_SAMLPETEXT); m_Current = (LPCTSTR) str;

SetData(); UpdateData(FALSE); }

Page 12: Developing International Software When a localized software fails

Localizing Fixed Localizing Fixed WORDPADWORDPAD

Copy old project from directory Copy old project from directory "Wordpad Start" or "Wordpad "Wordpad Start" or "Wordpad implemented" to "Wordpad fixed" implemented" to "Wordpad fixed"

Update source string list and Update source string list and translation listtranslation list

Translate new messages (Ids in Translate new messages (Ids in StringTable 200-203)StringTable 200-203)

Start PASSOLOOpen "Wordpad Start"

Page 13: Developing International Software When a localized software fails

Testing fixed WORDPADTesting fixed WORDPAD

Testing WORDPAD with "test.rtf" Testing WORDPAD with "test.rtf" In directory "Wordpad fixed" In directory "Wordpad fixed"

Start WORDPAD

Page 14: Developing International Software When a localized software fails

More i18n IssuesMore i18n Issues

Page 15: Developing International Software When a localized software fails

Internationalization Internationalization (i18n) First(i18n) First

Documentation can be created without Documentation can be created without having to know that it will be having to know that it will be translated.translated. But technologies like controlled language But technologies like controlled language

and good terminology management can and good terminology management can improve the process!improve the process!

Creating software without having Creating software without having localization in mind, means: localization in mind, means: Source code must be changedSource code must be changed High localization costs, delaysHigh localization costs, delays Even project failure is possibleEven project failure is possible

Page 16: Developing International Software When a localized software fails

i18n – A Definitioni18n – A Definition

Internationalization covers all Internationalization covers all activities during the development activities during the development process, which make it possible to process, which make it possible to adapt a product/program to different adapt a product/program to different countries and cultures (also called countries and cultures (also called locales).locales).

Page 17: Developing International Software When a localized software fails

i18n and the Human Factori18n and the Human Factor

Developers are often not aware of Developers are often not aware of the problemthe problem

Developers like to re-invent the Developers like to re-invent the wheelwheelint lower(int c){ if (c >= 'A' && c <= 'Z') return (c - 'A' + 'a');

return c;}

Page 18: Developing International Software When a localized software fails

i18n and character sets 1i18n and character sets 1

'Old' character sets (code page 'Old' character sets (code page based) use the same code for based) use the same code for different characters different characters

Page 19: Developing International Software When a localized software fails

i18n and character set 2i18n and character set 2

'Old' character sets use complicated 'Old' character sets use complicated coding schemes for Asian scriptscoding schemes for Asian scripts

Page 20: Developing International Software When a localized software fails

I18n and character sets 3I18n and character sets 3 Unicode is the new character set with about 1 Unicode is the new character set with about 1

Mio. possible charactersMio. possible characters But mapping to code page based character sets But mapping to code page based character sets

might still be necessary (if this fails you get '?') might still be necessary (if this fails you get '?') (Character does not exist in code page) (Character does not exist in code page)

Sometimes you see the wrong characters. This Sometimes you see the wrong characters. This happens, when code page based characters are happens, when code page based characters are rendered with the wrong code page. rendered with the wrong code page. (Character OK, code page wrong)(Character OK, code page wrong)

Sometimes you see squares. This happens, Sometimes you see squares. This happens, when characters cannot be displayed with the when characters cannot be displayed with the selected font. (Character OK, Font wrong).selected font. (Character OK, Font wrong).

Page 21: Developing International Software When a localized software fails

i18n and Programming 1i18n and Programming 1

Typical ... but wrong!Typical ... but wrong!

Program code and GUI must be Program code and GUI must be separatedseparated

Grammar is not the same for all Grammar is not the same for all languageslanguages

Translating text fragments is more Translating text fragments is more difficult, than translating in contextdifficult, than translating in context

C:AfxMessageBox("%d errors in file %s", cnt, fname);

Basic:MsgBox(CStr(cnt) & " errors in file " & fname)

Page 22: Developing International Software When a localized software fails

i18n and Programming 2i18n and Programming 2

Translated strings are often longerTranslated strings are often longer

Take care when designing dialogs/formsTake care when designing dialogs/forms Take care when using static buffers in Take care when using static buffers in

softwaresoftware

Page 23: Developing International Software When a localized software fails

i18n and Graphics 1i18n and Graphics 1

Don‘t use/paint text in graphicsDon‘t use/paint text in graphics

Page 24: Developing International Software When a localized software fails

i18n and Graphics 2i18n and Graphics 2

Even graphics without text can be Even graphics without text can be locale specific!locale specific!

Page 25: Developing International Software When a localized software fails

i18n - Summaryi18n - Summary

Has to be done during document Has to be done during document creation (Programming)creation (Programming)

Is important for efficient localizationIs important for efficient localization Has many aspects and a lot of things Has many aspects and a lot of things

can go wrongcan go wrong If the localized product fails, it does If the localized product fails, it does

not mean that the localizer failednot mean that the localizer failed

Page 26: Developing International Software When a localized software fails

i18n – Tools, Books, Magazinesi18n – Tools, Books, Magazines

SGIL von Everlasting SystemsSGIL von Everlasting Systems http://http://www.everlastingsystems.comwww.everlastingsystems.com//

I18N Expeditor von I18N Expeditor von OneRealmOneRealm http://http://www.onerealm.comwww.onerealm.com//

Developing International SoftwareDeveloping International SoftwareDr. International, Microsoft Press 2002, ISBN 0-7356-1583-7Dr. International, Microsoft Press 2002, ISBN 0-7356-1583-7

Internationalization with Visual BasicInternationalization with Visual BasicMichael S. Kaplan, SAMS, ISBN 0-672-31977-2Michael S. Kaplan, SAMS, ISBN 0-672-31977-2

Internationalization and Localization using Internationalization and Localization using Microsoft .NETMicrosoft .NETNick Symmonds, APRESS, ISBN 1-59059-002-3Nick Symmonds, APRESS, ISBN 1-59059-002-3

Java InternationalizationJava InternationalizationAndy Deitsch & David Czarnecki, O'Reilly, ISBN 0-596-00019-7Andy Deitsch & David Czarnecki, O'Reilly, ISBN 0-596-00019-7

MultiLingual Computing & TechnologyMultiLingual Computing & Technologyhttp://http://www.multilingual.comwww.multilingual.com