Updated 2006-11-11 15:17:25 by lwv

KBK 9 July 2002 -

A correspondent, interesting in doing a translation of Tk's internal message catalog, asks:
 1. What is the procedure to assign proper hot key bindings for the new
 messages (those letters after & sign)?

Good question. As far as I can determine, the following table indicates which hotkeys must be distinct. An X in a given cell indicates that the accelerator in its row appears in at least one dialog together with the accelerator in its column. For example, the accelerator chosen for "Blue" must be distinct from the ones chosen for "Cancel", "Green", "OK", "Red", and "Selection:".

The dialogs that I've examined are:

All of these have been examined on Windows and Unix, with ::tk_strictMotif set to both 0 and 1.
          &Abort | -
           &Blue |    -
         &Cancel |    X  -
     &Directory: |       X  -
     File &name: |       X  X  -
    File &names: |       X  X     -
 Files of &type: |       X  X  X     -
         Fi&les: |       X  X     X     -
         &Filter |       X  X     X     X  -
        Fil&ter: |       X  X     X     X  X  -
          &Green |    X  X                       -
         &Ignore | X                                -
             &No |       X                             -
             &OK |    X  X  X     X     X  X  X  X        -
           &Open |       X  X  X     X                       -
            &Red |    X  X                       X        X     -
          &Retry | X     X                          X              -
           &Save |       X  X  X     X                                -
     &Selection: |    X  X  X     X     X  X  X  X        X     X        -
            &Yes |       X                             X                    -
                   &  &  &  &  F  F  F  F  &  F  &  &  &  &  &  &  &  &  &  &
                   A  B  C  D  i  i  i  i  F  i  G  I  N  O  O  R  R  S  S  Y
                   b  l  a  i  l  l  l  &  i  l  r  g  o  K  p  e  e  a  e  e
                   o  u  n  r  e  e  e  l  l  &  e  n        e  d  t  v  l  s
                   r  e  c  e        s  e  t  t  e  o        n     r  e  e
                   t     e  c  &  &     s  e  e  n  r              y     c
                         l  t  n  n  o  :  r  r     e                    t
                            o  a  a  f        :.                         i
                            r  m  m                                      o
                            y  e  e  &                                   n
: : s t
                                  :  y

 2. Is there any application that uses all or at least great number of
 these messages? Good translation requires good understanding of a
 context in which the messages appear.

Another good question. All of these messages are used by Tk itself. In particular, you can see most of them by doing the following:

(1) Bring up Wish on Windows. The console menu has the following:
    File            Edit            Help
      Source...       Cut             About...
      Hide Console    Copy
      Clear Console   Paste
      Exit            Delete

(On the Mac, Delete is replaced with Clear).

The "Source..." menu item brings up a dialog identical to the one from tk_getOpenFile that includes the messages
    Select a file to source
    Tcl Scripts
    All Files

The "About..." menu item brings up a message box with the message
    Tcl for Windows

followed by the version numbers of Tcl and Tk.

(2) Enter in the console the command:
      after 0 error Testing

which will display the dialog from bgerror.

This dialog includes the messages
    Application Error
    Skip Messages

If Details>> is selected, the dialog expands to show a stack trace, and the Details>> button is replaced with Save To Log. This last button opens the dialog from tk_getSaveFile, which includes the messages
    Select Log File
    Log Files
    Text Files
    All Files

(3) Experiment with tk_getOpenFile, tk_getSaveFile, and tk_chooseDirectory on Unix with ::tk_strictMotif set to both 0 and 1. The messages that result in the various dialogs and the error dialogs that can ensue include:
    Choose Directory
    Open Multiple Files
    Save As             - Titles for the dialog

    &Directory          - The directory in which a file appears
    File &name          - The name of the file to open or save
    Fi&les              - The list of files from which to choose
    Files of &type      - The allowable file types
    &Filter             - (Verb) The button that asks to update
                          the list of files according to a glob pattern
    Fil&ter             - (Noun) The glob pattern that chosen files must match
    &Selection          - The name of the directory to choose, or of the
                          file to open or save (Motif)
    &Open               - The button that opens a file for reading
    &Save               - The button that opens a file for writing
    &Cancel             - The button that cancels the operation
    &OK                 - The button that confirms a file or directory

    Cannot change to the directory "%1$s.
    Permission denied.

    Directory "%1$s" does not exist.

    File "%1$s" already exists.
    Do you want to overwrite it?

    File "%1$s" already exists.

    File "%1$s does not exist.

    Invalid file name "%1$s".

    Replace existing file?

(3) Do tk_chooseColor on Unix. The resulting dialog has the messages
    &Selection         - The color that has been selected

(4) Experiment with the various types of tk_messageBox: the buttons in the box can be
    &Abort &Retry &Ignore
    &OK &Cancel
    &Retry &Cancel
    &Yes &No
    &Yes &No &Cancel

That should cover most of what you see in one of the .msg files.

Category Local