47
Using An( Pa+erns in Interna(onaliza(on Training Elsebeth Flarup Page 1 .

Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

UsingAn(Pa+ernsinInterna(onaliza(onTraining

ElsebethFlarup

Page 1 .

Page 2: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Thejobofaninterna(onaliza(onevangelist

“SisyphusGif-sigh.gif”byChris2naHendricksislicensedunderCCBY4.0 2

!MEforthelast20years…

Page 3: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

MyusualMO1.   Ensuremanagementsupport

2.   Createguidelinesandtrainingsessions•  Definethebasicconcepts•  Explainwhyitisimportant

•  Categories•  -Textencoding

•  -Culturalformats

•  -Translatability

•  -etc.

•  Highlightdosanddon’tsforeach•  Providecodesnippetsasexamples

3

Page 4: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Somethinglikethis•  Storeandprocessdatainlocale-neutralformat

•  BUT:Alwaysdisplaylocale-specificformatstoenduser

•  Usethelocale-awareAPIsfromyourprogrammingplaQorm

•  Neverhardcodeformatsfordate/(me/numberetc.

•  Externalizealluser-visiblestringstostandardtransla(onfiletypes•  Andsoon…

4

Page 5: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Thestonekeptrollingbackdownthough…• A+en(on/par(cipa(onduringtrainingsessionsusuallynotgreat“Idon’tthinkIwilleverworkoninterna2onaliza2onissues”

“Howhardcanitbe…”

•  S(llhearingques(onslike“Can’ttheyjustuseworkarounds?”

“Thiscanwait2llnextrelease,right?”

•  Interna(onaliza(onissuesinternalizedasminor,impactnotreallyunderstood

5

Page 6: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

6

Page 7: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

7

Page 8: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

8

Page 9: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

9

Page 10: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

10

Page 11: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

11

Page 12: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

12

Page 13: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

13

Page 14: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

14

Page 15: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

UsingEnglishlanguagean(pa+erns• Alotmoreengagementduringface-to-facetraining

• Everybodyeasilyrecognizesalmosteverythingthatiswrongaccordingtoen_USlocaleexpecta(ons,andUSEnglishlanguage

• Actual“ahaexperiences”whenreferringbacktoini(alEnglishexamplesforeachcategory

• WhatwejustsawasparodyinEnglish:happensinotherlanguages/localesallthe8mewhenbestprac8cesarenotfollowed

15

Page 16: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Translatabilitybestprac(ces•  Donothardcodeanyuser-visiblestrings=>•  Usetherightencoding=>•  Donotconcatenatestringsincode=>

•  Bewareof“naturallanguage”UI=>•  Alwaysincludepunctua(onaspartofstring=>•  Useplaceholderswithcare=>

•  DonotcreateUIstringsthatlooklikecode=>•  Handlepluralforms=>

•  AllowforexpansionspaceinUIs=>

•  Donotreusestringsindifferentcontexts=>

16

Page 17: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Culturalformatsbestprac(ces•  Usethedate(meforma^ngAPIs=>

•  Donothardcodeorderofdateelements=>

•  Uselocale-awarewidgets(firstdayofweek,etc.)=>

•  UseAPIstoformatnumber/currency/percent=>

•  Usedatatypes,orderappropriateforregion=>•  Bewareofhardcodedvalida(onrules=>

•  Uselanguage-specificsortorder=>

17

Page 18: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Valueofexampletypes

Bestexamples/mostimpact

Reasonableeffect

S(lltryingtocomeupwithgood/be+erexamples

18

Varioustypesofconcatena2on

Date/2me/calendar/numberformats

Sortorder

UItrunca2ons

Datatypeslikenamesandaddresses

Valida2onrules(fore.g.phonenumbers)

Somestringconcatena2onandplaceholderusageissuescan’treallybedemonstratedusingEnglish

Contextissuesalsodifficulttodemonstrateconvincingly

Genderrelatedissues

Pluralformatissues

Page 19: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Somesampletrainingsec(ons

Page 20: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Concatena(on

Page 21: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Rememberthesestrings?

21

That’stheeffectyougetinotherlanguageswhensentencefragmentsareconcatenatedincode,withnoop(onforthetranslatortoswitchtheorderaround

Page 22: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Stringconcatena(on

•  Concatena(ngsentencefragmentsincodeisverytemp(ngasaquickanddirtyworkaround,butitbasicallymakescorrecttransla(onsintomostlanguagesimpossible

•  Assumethattranslatorsneedtorestructuresentencestotakedifferentsyntaxintoaccount

English:“Bobsent10emailsyesterday”“10daysago?”

LanguageX:“Emails10yesterdaysentBob”“¿for10daysago?”

•  So,avoidconcatena(ngpar(alstringstoformasentence–createanewstringforthecompletesentenceinstead

•  AND:alwaysincludeplaceholdersandpunctua(oninthestring,don’tassumeyoucanprefix/appendincode

•  Somelanguagesusedifferentpunctua(oncharacters,andtheymayneedtobeplaceddifferentlyrela(vetothetextstrings

22

Page 23: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

© Guidewire Software, Inc. All rights reserved. Do not distribute without permission. Page 23

Page 24: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

© Guidewire Software, Inc. All rights reserved. Do not distribute without permission. Page 24

// BAD, order may be incorrect for some languages

"agent.direc2ves.AgentDashboardDirec2ve.agent-dashboard.Open":"Open",

"agent.direc2ves.AgentDashboardDirec2ve.agent-dashboard.PolicyChanges":"PolicyChanges”

<divclass="2le-2tle">{{'agent.direc2ves.AgentDashboardDirec2ve.agent-dashboard.Open'|translate}}<br/>

{{'agent.direc2ves.AgentDashboardDirec2ve.agent-dashboard.PolicyChanges'|translate}}</div>

// GOOD, create a single string

"agent.direc2ves.AgentDashboardDirec2ve.agent-dashboard.OpenPolicyChanges":”Open<br>PolicyChanges”,

<divclass="2le-2tle">{{'agent.direc2ves.AgentDashboardDirec2ve.agent-dashboard.OpenPolicyChanges'|translate}}

</div>

Page 25: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

25

// BAD

"agent.ac2vity.date.filter.daysago":"daysago",

return'!'+dateDifference+$filter('translate')('agent.ac2vity.date.filter.daysago');

// GOOD – punctuation and placeholder in translatable string

"agent.ac2vity.date.filter.daysago":”!{{dateDifference}}daysago",

return$filter('translate')('agent.ac2vity.date.filter.daysago’,{dateDifference:date.result});

Page 26: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Concatena(oncanalsobedoneviaUIcontrols

•  UIelementswhichusesentencestructuremayalsoneeddifferentorderinotherlanguages

•  InJapanese,thedatecomesbeforethe“by”

•  TrytoavoidthistypeofUIifpossibleVerydifficulttomakeflexibleenoughtofitstructureofalllanguages

•  YoumayhavetomakeorderofUIcontrolsconfigurablebylanguage

26

Page 27: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Placeholders

Page 28: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Rememberthisstring?

28

That’sapaleversionofwhathappensinotherlanguagesyouuseplaceholdersinappropriately.Manylanguageshavesyntaxrulesaboutgendercorrespondencebetweennounsandadjec(ves,forinstance.Resul(nginpoten(allydisastroustransla(ons

Createanrecurringmee(ngwithyouragent

Page 29: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Placeholders

• Mainrules•  Onlyuseplaceholdersifabsolutelynecessary,andonlyforvaluesthatcanonlybeknownatrun2me

•  Createseveralstringsratherthanusingplaceholderifsubs2tu2onvalueisacommonnounorverb

“agent.create.new.ques(on”:“Createnew{{0}}?”where{{0}}canbereplacedby“policy”or“quote”

•  Guaranteedtocausegendercorrespondenceissuesinotherlanguages,dependingonreplacementvalue(insomelanguagesadjec2vesneeddifferentformdependingonnountheyapplyto)

•  Germannounscanbemasculine,feminineorneuter,forinstance.Requires3differentadjec2veconjuga2ons(and3differentgendermarkers:“der”,“die”,“das”asopposedtojust“the”inEnglish)

•  Inexampleabove,justcreate2separatestringswithoutplaceholders

29

Page 30: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Placeholders–example2

Cannot {0} Policy {1} : This account is held by a {2}, which is not suitable for {3} policy.

becomes:

Cannot move Policy 12345 : This account is held by a Company, which is not suitable for Personal Auto policy

-  Translatorsseeonlytheisolatedstring–havenoideawhatthepossiblesubs(tu(onvaluesare

-  NEVERuseplaceholderforcommonnounorverb- Insomelanguages,syntaxdiffersdependingonfirstlemerofnoun/verb(“impossibled'avancer”,but“impossibledesupprimer”)

-  EveninEnglish,orthographyisawkward(uppercaseCompany,missingar(cleforPersonalAuto)

Versionthatwouldbetranslatable(noplaceholderforverb,nounsremovedfromsyntaxcontext):

Cannot move policy {0}. Mismatch between account type ({1}) and policy type ({2})

30

Page 31: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Placeholders–example3

•  Englishsourcestringsconstructedfromfragmentsviaotherstringfilekeys

The Catastrophe {Term.Selected.Lower} is inconsistent with the {Term.Claim.Possessive.Lower} Loss Cause of {1}

Some of the {Term.Selected.Lower} reviews could not be completed.

{Term.Selected.Lower} -> “selected”

{Term.Claim.Possessive.Lower} -> “claim’s”

-  Intransla(ons,nouns,adjec(ves,verbsgetconjugateddependingonsentencesyntax,soallsuchvariableshavetobereplacedwithrealstrings–asinGerman:

Die gewählte Catastrophe stimmt nicht mit der Schadensursache {1} überein.

Einige der ausgewählten Reviews konnten nicht fertiggestellt werden.

•  Transla(ngstringscontainingsuchvariablesbecomeshugelymoreexpensiveand(me-consuming(translatorwillhavetohuntforrealvaluesofplaceholderstrings)

31

Page 32: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Pluralformats

Page 33: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Plurals–rememberthis:

•  Englishissimple–just2forms,singularandplural-2stringscancoverallpossibili(es:singular=Youhave{0}daylen

plural_zero=Youhave{0}dayslen

•  Youcanevenuseasimplehack:“Youhave{0}day(s)leo”toavoidprobleminEnglish

•  Fineforsomelanguages,butfarfromall–upto6formsneededinsomelanguages

•  Polish,Russian,forexample(andevenFrenchusesslightlydifferentrules):

33

Page 34: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

LocalizingUIStrings–pluralforms

Thetablebelowshowswhatstringisreturneddependingontheac(velanguage

Ac(veTransla(on

n NoTransla2on English Russian0 "You have 0 new message(s)." "You have 0 new messages." "У вас 0 новых сообщений."

1 "You have 1 new message(s)." "You have 1 new message." "У вас 1 новое сообщение."

2 "You have 2 new message(s)." "You have 2 new messages." "У вас 2 новых сообщения."

37 "You have 37 new message(s)." "You have 37 new messages." "У вас 37 новых сообщений."

Page 35: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Handlingplurals

•  StringscodedforEnglishdonotworkEitherjustincorrectwhendisplayedwithcertaindigits

Orinsanelyuglytransla2onslike“epizód/a/y”totrytoincludeallpossibleformatsinonetransla2on(Slovakinthiscase)

• Usei18nlibrarywithsupportforpluralformatsinalllanguages

• Oruseworkaround:Use“subject:predicate”formatinsteadof“naturallanguage”:“Dayslen:{0}”

35

Page 36: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Stringcontext

Page 37: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Stringcontext

•  Manyiden(calstringsareusedinmanydifferentcontextsOn/Off/Custom/High/Low/Medium/Normal/Private/Personaletc.

•  Howtheyshouldbetranslateddependsonthegenderofassociatednoun

•  Needdifferentversionsofsuchstringsforeverysinglenountheyapplyto

•  Again,Englishissimple,sotheexampledoesnotconveyhowprevalentthiscanbe:

37

Page 38: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

UItrunca(ons

Page 39: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

ProvideexpansionspaceintheUI

•  Expectthatstringswillexpandinotherlanguages•  Forshortstringsupto10characters,expectatleast100%expansion•  Don’texpecttranslatorscan“justmaketransla(onsshorter”

•  Insomecases,therereallyarenoshorterwords

•  Sodonothardcodecontrolsizes,allowdynamicresizingifpossible–soyouavoid…

39

Page 40: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Date/(me/numberformats

Page 41: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Dosanddon’ts•  Alwaysdisplaylocale-specificformatstoenduserDisplaydate/2me/numbers/currency/sortorder/calendar/measurements/etc.accordingtouser’spreferences

Butstoreandprocesstheminlocale-neutralformatinternally

•  UseAPIsfromprogrammingplaQormtoperformforma^ngAllprogrammingplavormshavestandardAPIsforaccessinganddisplayingthelocalecategories

Don’thardcodeformat:

Don’thardcodepa+ern:

Don’tassumefirstdayofweek,weekends,etc.:

41

Page 42: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Dosanddon’ts•  Don’tusestringsintransla(onfilesforlocaleforma^ng–uselocaledatafromplaQorm(CLDRinmostcases)Namesofdays/months,date/2mepamerns,etc.

Nomaintenanceandtransla2oncost

Doesnotrelyontranslatorscorrectlyhandlingformawngpamerns

•  Translatorshavedifficultyunderstandingformatpamernslike“EEE,MMMd,yyyy”

•  Theyeitherleavethemunlocalized,or“translate”to“UUU,MMM,dåååå”

Supportformanymorelocalesandconsistentformatscomparedtoplacingformawngpamernsintranslatablefiles

Allowsustosupportregionalpreferenceswithno2etoUItransla2ons

Ifyouneedcustomformats,useICU’s“skeletons”

42

Page 43: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Sortorder

Page 44: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Issortorderreallyimportant?

44

•  Sortof☺

•  Whenalistofcountrieswithseveralhundredentriesissortedlikethis,itbecomes“challenging”tofindwhatyouarelookingfor–inanylanguage

•  Comparesortorderinlistsonright–radicallydifferentexpecta(onsforDanishvs.Englishlanguageusers

Page 45: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Dataelements,valida(onrules

Page 46: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

46

Page 47: Using An( Pa+erns in Interna(onaliza(on Training...Or insanely ugly translaons like “epizód/a/y” to try to include all possible formats in one translaon (Slovak in this case)

Dosanddon’ts•  English-speakinguserintheUSwouldbeunhappywithpreviousscreen•  Japanese-speakinguserinJapanequallyunhappywithUS-centriccontent•  Understandrequirementsupfront

•  Usealreadyimplementedname/address/phoneformatwidgets

•  Don’thardcodevalida(onrulestoexpectdatatoconformtoUSregiondefaultsExamples:zipcodes,telephoneformats

47