Internationalisation
Rob Cozens
rcozens at pon.net
Sat Jan 4 05:51:12 EST 2003
>My question is: what is the procedure for 'loading' all the text
>ONTO the interface? How does one change all the text on menus,
>buttons, label fields, etc?
G'day Igor,
Here's how Serendipity Library does it [see case loadMe]:
[function sdbMessage(messageLineNumber) returns the text in line
messageLineNumber of the message text file]
constant sdbUpdateFieldToolTip=187 -- [other constants omitted]
on menuPick thePick
play audioClip "click.au"
put sdbMessage(sdbQuitMenuItem) into quitMe
put sdbMessage(sdbLoadFileMenuItem) into loadMe
put sdbMessage(sdbTranslateMenuItem) into translateMe
put sdbMessage(sdbAdjustFeedbackMenuItem) into adjustMe
switch thePick
case quitMe
shutMeDown
break
case translateMe
modeless stack "Message Translator"
break
case adjustMe
modal stack "Audio Feedback Level"
break
case loadMe
put the defaultFolder into savedDefault
get the effective fileName of this stack
put "/" after it
set the itemDelimiter to "/"
put "SDB_Message_Files" into the last item of it
answer file sdbMessage(sdbSelectMessageFile) with it
play audioClip "click.au"
if it is empty then
set the defaultFolder to savedDefault
exit menuPick
end if
put "file:" before it
put URL it into messageText
if the result is not empty then
set the defaultFolder to savedDefault
answer sdbMessage(sdbImportReadError) with sdbMessage(sdbOKTranslated)
play audioClip "click.au"
exit menuPick
end if
set the defaultFolder to savedDefault
if the platform is not "MacOS" then put macToISO(messageText)
into messageText -- My message file is stored in ASCII format on all
platforms
get the number of lines of messageText
if it <> sdbMessageLineCount then
answer
sdbMessage(sdbLineCountWarning1)&&sdbMessageLineCount&"."&return&sdbMessage(sdbLineCountWarning2)&&it&"."
with sdbMessage(sdbOKTranslated)
play audioClip "click.au"
exit menuPick
end if
answer line 1 to 2 of messageText with
sdbMessage(sdbCancelTranslated) or sdbMessage(sdbLoadTranslated)
if it is sdbMessage(sdbCancelTranslated) then exit menuPick
loadSDBMessageText messageText
put messageText into field "Messages" of card 1
set the name of button id 1043 to sdbMessage(sdbFileMenu)
set the text of button id 1043 to
sdbMessage(sdbAdjustFeedbackMenuItem)&return&"-"&return&sdbMessage(sdbLoadFileMenuItem)&return&sdbMessage(sdbTranslateMenuItem)&return&"-"&return&sdbMessage(sdbQuitMenuItem)
set the name of button id 1044 to sdbMessage(sdbHelpMenu)
set the text of button id 1044 to
sdbMessage(sdbHelpMenuItem)&return&"-"&return&sdbMessage(sdbAboutSerendipityMenuItem)
set the toolTip of button "Database" of card "Index" to
sdbMessage(sdbDatabaseToolTip)
set the toolTip of button "Dates" of card "Index" to
sdbMessage(sdbDateToolTip)
set the toolTip of button "Edits" of card "Index" to
sdbMessage(sdbEditToolTip)
set the toolTip of button "Formats" of card "Index" to
sdbMessage(sdbFormatToolTip)
set the toolTip of button "Lists" of card "Index" to
sdbMessage(sdbListToolTip)
set the toolTip of button "Tables" of card "Index" to
sdbMessage(sdbTableToolTip)
set the toolTip of button "Thumbs Down" of card 1 of stack
"Number Edit Mask" to sdbMessage(sdbCancelTranslated)
set the toolTip of button "Thumbs Up" of card 1 of stack "Number
Edit Mask" to sdbMessage(sdbSetFormatToolTip)
set the label of stack "Number Edit Mask" to
sdbMessage(sdbNumberFormatTranslated)
set the toolTip of button "Thumbs Down" of card 1 of stack
"Message Translator" to sdbMessage(sdbQuitToolTip)
set the toolTip of button "Thumbs Up" of card 1 of stack "Message
Translator" to sdbMessage(sdbFileTranslationPrompt)
get field "Line Count" of card 1 of stack "Message Translator"
if it is not empty then
put sdbMessage(sdbOfTranslated) into word 2 to -2 of it
put it into field "Line Count" of card 1 of stack "Message Translator"
end if
set the label of stack "Message Translator" to
sdbMessage(sdbMessageTranslatorLabel)
set the toolTip of field "Import File" of card 1 of stack
"sdbImport" to sdbMessage(sdbImportFileToolTip)
set the toolTip of button "Thumbs Down" of card 1 of stack
"sdbImport" to sdbMessage(sdbCancelTranslated)
set the toolTip of button "Thumbs Up" of card 1 of stack
"sdbImport" to sdbMessage(sdbImportToolTip)
set the toolTip of image "Reject Duplicates.gif" of card 1 of
stack "sdbImport" to sdbMessage(sdbOverwriteDuplicatesToolTip)
set the toolTip of image "Overwrite Duplicates.gif" of card 1 of
stack "sdbImport" to sdbMessage(sdbRejectDuplicatesToolTip)
set the label of stack "sdbImport" to sdbMessage(sdbDataImportLabel)
set the toolTip of button "Record Type Title" of card 1 of stack
"sdbExport" to sdbMessage(sdbRecordTypeToolTip)
set the toolTip of field "Database Field Delimiter" of card 1 of
stack "sdbExport" to
theCharacterSet&&sdbMessage(sdbDatabaseFieldTranslated)&&delimiterTranslated
set the toolTip of button "Beginning Key Title" of card 1 of
stack "sdbExport" to sdbMessage(sdbBeginningKeyToolTip)
set the toolTip of button "Ending Key Title" of card 1 of stack
"sdbExport" to sdbMessage(sdbEndingKeyToolTip)
set the toolTip of field "Export File" of card 1 of stack
"sdbExport" to sdbMessage(sdbExportFileToolTip)
set the toolTip of button "Thumbs Down" of card 1 of stack
"sdbExport" to sdbMessage(sdbCancelTranslated)
set the toolTip of button "Thumbs Up" of card 1 of stack
"sdbExport" to sdbMessage(sdbExportToolTip)
set the label of stack "sdbExport" to sdbMessage(sdbDataExportLabel)
set the toolTip of button "Thumbs Down" of card 1 of stack "Audio
Feedback Level" to sdbMessage(sdbCancelTranslated)
set the toolTip of button "Thumbs Up" of card 1 of stack "Audio
Feedback Level" to sdbMessage(sdbUseLevelToolTip)
set the label of stack "Audio Feedback Level" to
sdbMessage(sdbAudioFeedbackLabel)
set the label of stack "sdbEditor" to sdbMessage(sdbFieldEditLabel)
set the toolTip of button "Previous Field" of card 1 of stack
"sdbEditor" to sdbMessage(sdbPreviousFieldToolTip)
set the toolTip of button "Next Field" of card 1 of stack
"sdbEditor" to sdbMessage(sdbNextFieldToolTip)
set the toolTip of button "Thumbs Up" of card 1 of stack
"sdbEditor" to sdbMessage(sdbUpdateFieldToolTip)
put sdbMessage(sdbOfTranslated) into field "of Translated" of
card 1 of stack "sdbEditor"
send "loadSDBMessages" to stack "sdbDatabase Template"
put sdbMessage(sdbCommentNote) into field "Comments" of card 2 of
stack "sdbDatabase Template"
save this stack
answer sdbMessage(sdbMessagesLoaded) with sdbMessage(sdbOKTranslated)
play audioClip "click.au"
break
end switch
end menuPick
on loadSDBMessages
set the name of button 1 to sdbMessage(sdbFileMenu)
set the text of button 1 to
sdbMessage(sdbBrowseDBMenuItem)&return&"-"&return&sdbMessage(sdbQuitMenuItem)
set the name of button 2 to sdbMessage(sdbEditMenu)
set the text of button 2 to
sdbMessage(sdbChangePasswordsMenuItem)&return&"-"&return&sdbMessage(sdbNewRecordMenuItem)&return&sdbMessage(sdbDeleteRecordMenuItem)&return&"-"&return&sdbMessage(sdbExportRecordsMenuItem)&return&sdbMessage(sdbImportRecordsMenuItem)&return&"-"&return&sdbMessage(sdbFieldEditMenuItem)
set the name of button 3 to sdbMessage(sdbHelpMenu)
set the text of button 3 to
sdbMessage(sdbLoadHelpMenuItem)&return&"-"&return&sdbMessage(sdbAboutSDBMenuItem)
put sdbMessage(sdbUpdateTranslated) into word 1 to -2 of field
"Update" of card 1
set the toolTip of button "Locked Files" of card 1 to
sdbMessage(sdbUnlockDBToolTip)
set the toolTip of button "Unlocked Files" of card 1 to
sdbMessage(sdbLockDBToolTip)
set the toolTip of field "File Index" of card 2 to
sdbMessage(sdbSelectTypeToolTip)
set the toolTip of button "Notes Toggle" of card 2 to
sdbMessage(sdbShowNotesToolTip)
set the toolTip of button "Record Lock" of card 3 to
sdbMessage(sdbUnlockRecordToolTip)
set the toolTip of button "First Record" of card 3 to
sdbMessage(sdbFirstRecordToolTip)
set the toolTip of button "Previous Record" of card 3 to
sdbMessage(sdbPreviousRecordToolTip)
set the toolTip of button "Index" of card 3 to sdbMessage(sdbIndexToolTip)
set the toolTip of button "Next Record" of card 3 to
sdbMessage(sdbNextRecordToolTip)
set the toolTip of button "Last Record" of card 3 to
sdbMessage(sdbLastRecordToolTip)
end loadSDBMessages
--
Rob Cozens
CCW, Serendipity Software Company
http://www.oenolog.com/who.htm
"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."
from "The Triple Foole" by John Donne (1572-1631)
More information about the use-livecode
mailing list