quit on Mac OS X

Rob Cozens rcozens at pon.net
Sun Jun 16 10:39:04 CDT 2002


>I've made an app with Rev for Mac OS X 10.1.5 in French
>I don't need to set a "Quit" menu because the first menu 
>(application menu) has as last item a "quit" function.
>Now I'd like to translate this item in French
>Quit -> Quitter with a "/Q" keyboard shortcut.
>How to proceed ?

Salut Yves,

I believe the Revolution Team's answer is "use the Profile Manager to 
create a French profile with the contents of the menu (and the 
menuPick handler?) changed".

However, the Profile Manager is the one Revolution tool I have not 
tried to incorporate in my library.  Why is this?  Because I want my 
applications end-user translatable, not limited to predetermined 
profiles.

When Serendipity Library is released, it will include the capability 
to load all menus, menuItems, tool tips, prompts, error messages, and 
selected labels from a text file in any (Western at least) language:

constant sdbMessageLineCount=104 -- other constants & called handlers removed

on menuPick thePick
   global sdbMessages
   put sdbMessage(sdbQuitMenuItem) into quitMe
   put sdbMessage(sdbLoadFileMenuItem) into loadMe
   switch thePick
   case quitMe
     shutDown
     break
   case loadMe
     get the effective fileName of this stack
     put "/" after it
     set the itemDelimiter to "/"
     put "sdbMessage Files" into the last item of it
     answer file sdbMessage(sdbSelectMessageFile) with it
     if it is empty then exit menuPick
     put "file:" before it
     put URL it into messageText
     if the result is not empty then
       answer sdbMessage(sdbImportReadError)
       exit menuPick
     end if
     get the number of lines of messageText
     if it <> sdbMessageLineCount then
       answer 
sdbMessage(sdbLineCountWarning1)&&sdbMessageLineCount&&sdbMessage(sdbLinesTranslated)&return&sdbMessage(sdbLineCountWarning2)&&it&&sdbMessage(sdbLinesTranslated)
       exit menuPick
     end if
     answer line 1 to 2 of messageText with 
sdbMessage(sdbCancelTranslated) or sdbMessage(sdbLoadTranslated) -- 
Show file title & translator's name
     if it is sdbMessage(sdbCancelTranslated) then exit menuPick
     put messageText into field "Messages" of card 1
     put messageText into sdbMessages
     set the name of button id 1043 to sdbMessage(sdbFileMenu)
     set the text of button id 1043 to 
sdbMessage(sdbLoadFileMenuItem)&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 image "Thumbs Down.gif" of card 1 of stack 
"Number Edit Mask" to sdbMessage(sdbCancelTranslated)
     set the toolTip of image "Thumbs Up.gif" 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 field "Import File" of card 1 of stack 
"sdbImport" to sdbMessage(sdbImportFileToolTip)
     set the toolTip of image "Thumbs Down.gif" of card 1 of stack 
"sdbImport" to sdbMessage(sdbCancelTranslated)
     set the toolTip of image "Thumbs Up.gif" of card 1 of stack 
"sdbImport" to sdbMessage(sdbImportToolTip)
     get sdbMessage(sdbDelimiterTranslated)
     set the toolTip of field "Record Delimiter" of card 1 of stack 
"sdbImport" to sdbMessage(sdbRecordTranslated)&&it
     set the toolTip of field "Field Delimiter" of card 1 of stack 
"sdbImport" to sdbMessage(sdbFieldTranslated)&&it
     set the label of stack "sdbImport" to sdbMessage(sdbDataImportLabel)
     send "loadSDBMessages" to stack "sdbDatabase Template"
     put sdbMessage(sdbCommentNote) into field "Comments" of card 2 of 
stack "sdbDatabase Template" -- can't include above...could overwrite 
user comments in live db
     save this stack
     answer sdbMessage(sdbMessagesLoaded)
     break
   end switch
end menuPick

Note that the menus are changed by changing the name & contents of 
the menu buttons, which are referred to by id.

Having shown you the way to make your app user-translatable, I hope 
you will have to good grace not to release it in that form...until 
after the Serendipity Library is released (or bite your tongue when I 
claim to have created the first end-user translatable app in 
Revolution).  :{`)

PS: Would you like to volunteer to translate my 104 lines (402 words) 
of text to French, Dutch, and/or Flemish?  If so, contact me 
privately.
-- 

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