Re: Localisation for Apple menu in tclkit-darwin-aqua?
Pat Thoyts <[email protected]> Wed, 10 Mar 2010 20:37:47 +0000
| Newsgroups | gmane.comp.lang.tcl.starkit |
|---|---|
| Message-ID | <[email protected]> |
On 10 March 2010 20:25, Zbigniew Diaczyszyn <[email protected]> wrote: > Compiling an application with tclkit-darwin-aqua I wonder if it is possible > to customize the Apple menu items for other languages than English. > > The application itself is using the msgcat package but "About Tcl/Tk" or > "Preferences" and so on will appear in English although the Snow Leopard OS > is running with a German version and the Finder, for example, is using > German vocabulary. > > Can I tell tclkit-darwin-aqua to take the system's locale? > > Zbigniew It is up to you to make the menus use msgcat. The Tk library does have a couple of very useful but I think undocumented functions to help with this. tk::AmpMenuArgs takes a menu and a msgcat string and extracts the & marker so that any accelerators are localized along with the string. A corresponding tk::AmpWidget creates widgets in the same way. eg: tk::AmpWidget ttk::label .dialog.name -text [mc "&Username"] tk::AmpWidget ttk::radiobutton .dialog.enable -text [mc "&Enable"] and tk:AmpMenuArgs .menu.file add command -label [mc &Open] -command [list Open] tk::AmpMenuArgs .menu.file add command -label [mc &New] -command [list New] You can see these being used in the console.tcl file and in the core dialog implementations. The systems locale is read on startup and msgcat::mclocale should already be set to a suitable value (ie: de_de for a German system I think.) If you have a msgs/de.msg file loaded it should make use of it. In my application I've got the application binary in tkchat.vfs/bin/tkchat.tcl and a tkchat.vfs/bin/msgs/ directory with locale files. In the program code we call: msgcat::mcload [file join $starkit::topdir bin msgs] so ensure msgcat looks in the right place. Pat Thoyts -- You received this message because you are subscribed to the "starkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/starkit?hl=en