Best practice to develop a good notes application from the globalization perspective
1. Best practice to develop a good Notes application from the globalization perspective Xiao Feng Ji: [email_address] Ya Ling Xu: [email_address] IBM Lotus Notes/Domino Globalization Team
24. Do not use translatable strings as programming conditions Listing 5. Code pieces for using translatable strings as programming conditions 1. REM "Begin Do Not Translate" 2. Const DSPIND = "dspIndividualAccess" 3. REM "End Do Not Translate" 4. REM "Begin Translatable Text” 5. Const CALENDER_NOTICES = "Calendar notices are automatically forwarded to this person" 6. REM "End Translatable Text” 7. Set item = note.getfirstitem(DSPIND) 8. strIndividualAccess = item.Text 9. lposition = Instr( strIndividualAccess, CALENDER_NOTICES) 10. If lposition > 0 And lposition <> 1 Then 11. ' strip off fwd msg 12. strIndividualAccess = Left( strIndividualAccess, lposition-2 ) 13. Elseif lposition = 1 Then 14. strIndividualAccess = "" 15. Else 16. strIndividualAccess = Left( strindividualAccess, Len(strindividualAccess)-1) 17. End If
25.
26. Do not use translatable strings as programming conditions Listing 7. These functions in LotusScript and Formula should avoid to be used for translatable strings LotusScript @Formula Covert Cstr, Cint, Cdat, Abstract, StrConv, Lcase, Ucase, @LowerCase, @ProperCase, @LwerCase, @UpperCase, @TextToNumber, @TextToTime, @Explode, @Replace Compare StrToken, StrCompare, Split, like @ReplaceSubstring, @Matches@Like, @Contains Length Mid, Len, LenC @Length Position Left, StrLeft, StrLeftback, Right, StrRight, StrRightback, Instr, Trim, Contains, RightBP, MidBP @Left, @Middle, @Middleback, @Begins, @Ends, @LeftBack, @RightBack, @Right Other Join @Word
27.
28.
29.
30.
31.
32.
33. Never “hard code” strings in your code (cont.) Listing 14. A good example to define the variables instead of hard code the strings in codes Function GetString(nIndex As Integer, vData As Variant) As String REM "Begin Translatable Text” Const xxMessage = "Message to: " Const xxMessageStatus = " Message status: " Const xxMessageFailReason = " Recall failure reason: " Const xxMessageInitia= "Your recall request has been initiated. For more information, open the Recall Status report for this message when you receive it." Const xxMessageOtherReport = "Other delivery reports. (No recall information is available) " REM "End Translatable Text” Select Case nIndex Case RECALL_STRING_MSGTO GetString = xxMessage Case RECALL_STRING_MSGSTATUS GetString = xxMessageStatus Case RECALL_STRING_FAILREASON GetString = xxMessageFailReason Case RECALL_STRING_NORESPONSES GetString = xxMessageInitia Case RECALL_STRING_OTHERREPORT GetString = xxMessageOtherReport End Select End Function
34.
35.
36. Create the alias for the keyword of option field (e.g. Listbox, Checkbox, etc) Figure7. Listbox choices list