diff options
author | a_kovalenko <a_kovalenko> | 2002-06-10 00:15:42 (GMT) |
---|---|---|
committer | a_kovalenko <a_kovalenko> | 2002-06-10 00:15:42 (GMT) |
commit | 2d16e519a080ed6d8c55721f49a707e28db9532d (patch) | |
tree | e2f9f905ff561612501e85c0d8bf86a1f4531c1c /library/tkfbox.tcl | |
parent | 8f7a5e090555d59da1db17e4881ac68aee343859 (diff) | |
download | tk-2d16e519a080ed6d8c55721f49a707e28db9532d.zip tk-2d16e519a080ed6d8c55721f49a707e28db9532d.tar.gz tk-2d16e519a080ed6d8c55721f49a707e28db9532d.tar.bz2 |
Added "magic ampersand" approach for translated strings in standard dialogs.
All translations were modified to work with "magic ampersand".
Russian translations added.
Diffstat (limited to 'library/tkfbox.tcl')
-rw-r--r-- | library/tkfbox.tcl | 87 |
1 files changed, 41 insertions, 46 deletions
diff --git a/library/tkfbox.tcl b/library/tkfbox.tcl index 0522210..1a923fb 100644 --- a/library/tkfbox.tcl +++ b/library/tkfbox.tcl @@ -11,7 +11,7 @@ # files by clicking on the file icons or by entering a filename # in the "Filename:" entry. # -# RCS: @(#) $Id: tkfbox.tcl,v 1.33 2002/04/29 13:17:44 bagnonm Exp $ +# RCS: @(#) $Id: tkfbox.tcl,v 1.34 2002/06/10 00:15:42 a_kovalenko Exp $ # # Copyright (c) 1994-1998 Sun Microsystems, Inc. # @@ -979,7 +979,9 @@ proc ::tk::dialog::file::Create {w class} { # f1: the frame with the directory option menu # set f1 [frame $w.f1] - label $f1.lab -text "[mc "Directory:"]" -under 0 + bind [::tk::AmpWidget label $f1.lab -text "[mc "&Directory:"]" ] \ + <<AltUnderlined>> [list focus $f1.menu] + set data(dirMenuBtn) $f1.menu set data(dirMenu) [tk_optionMenu $f1.menu [format %s(selectPath) ::tk::dialog::file::$dataName] ""] set data(upBtn) [button $f1.up] @@ -1007,18 +1009,16 @@ static char updir_bits[] = { # if { [string equal $class TkFDialog] } { if { $data(-multiple) } { - set fNameCaption "[mc {File names:}]" + set fNameCaption "[mc {File &names:}]" } else { - set fNameCaption "[mc {File name:}]" + set fNameCaption "[mc {File &name:}]" } - set fTypeCaption [mc "Files of type:"] - set fCaptionWidth [mcmax $fNameCaption $fTypeCaption] + set fTypeCaption [mc "Files of &type:"] + set fCaptionWidth [::tk::mcmaxamp $fNameCaption $fTypeCaption] set fCaptionWidth [expr {$fCaptionWidth<14?14:$fCaptionWidth}] - set fNameUnder 5 set iconListCommand [list ::tk::dialog::file::OkCmd $w] } else { - set fNameCaption [mc "Selection:"] - set fNameUnder 0 + set fNameCaption [mc "&Selection:"] set fCaptionWidth [string length $fNameCaption] set iconListCommand [list ::tk::dialog::file::chooseDir::DblClick $w] } @@ -1031,8 +1031,8 @@ static char updir_bits[] = { # f2: the frame with the OK button and the "file name" field # set f2 [frame $w.f2 -bd 0] - label $f2.lab -text $fNameCaption -anchor e -width $fCaptionWidth \ - -under $fNameUnder -pady 0 + bind [::tk::AmpWidget label $f2.lab -text $fNameCaption -anchor e -width $fCaptionWidth \ + -pady 0] <<AltUnderlined>> [list focus $f2.ent] set data(ent) [entry $f2.ent] # The font to use for the icons. The default Canvas font on Unix @@ -1051,8 +1051,8 @@ static char updir_bits[] = { # use a button widget to emulate a label widget (by setting its # bindtags) - set data(typeMenuLab) [button $f3.lab -text $fTypeCaption \ - -anchor e -width $fCaptionWidth -under 9 \ + set data(typeMenuLab) [::tk::AmpWidget button $f3.lab -text $fTypeCaption \ + -anchor e -width $fCaptionWidth \ -bd [$f2.lab cget -bd] \ -highlightthickness [$f2.lab cget -highlightthickness] \ -relief [$f2.lab cget -relief] \ @@ -1060,22 +1060,23 @@ static char updir_bits[] = { -pady [$f2.lab cget -pady]] bindtags $data(typeMenuLab) [list $data(typeMenuLab) Label \ [winfo toplevel $data(typeMenuLab)] all] - set data(typeMenuBtn) [menubutton $f3.menu -indicatoron 1 \ -menu $f3.menu.m] set data(typeMenu) [menu $data(typeMenuBtn).m -tearoff 0] $data(typeMenuBtn) config -takefocus 1 -highlightthickness 2 \ -relief raised -bd 2 -anchor w + bind $data(typeMenuLab) <<AltUnderlined>> [list focus \ + $data(typeMenuBtn)] } # the okBtn is created after the typeMenu so that the keyboard traversal # is in the right order - set maxWidth [mcmax OK Cancel] + set maxWidth [::tk::mcmaxamp &OK &Cancel] set maxWidth [expr {$maxWidth<6?6:$maxWidth}] - set data(okBtn) [button $f2.ok -text "[mc "OK"]" \ - -under 0 -width $maxWidth -default active -pady 3] - set data(cancelBtn) [button $f3.cancel -text "[mc "Cancel"]" \ - -under 0 -width $maxWidth -default normal -pady 3] + set data(okBtn) [::tk::AmpWidget button $f2.ok -text "[mc "&OK"]" \ + -width $maxWidth -default active -pady 3] + set data(cancelBtn) [::tk::AmpWidget button $f3.cancel -text "[mc "&Cancel"]" \ + -width $maxWidth -default normal -pady 3] # pack the widgets in f2 and f3 # @@ -1103,9 +1104,7 @@ static char updir_bits[] = { $data(upBtn) config -command [list ::tk::dialog::file::UpDirCmd $w] $data(cancelBtn) config -command [list ::tk::dialog::file::CancelCmd $w] bind $w <KeyPress-Escape> [list tk::ButtonInvoke $data(cancelBtn)] - bind $w <Alt-c> [list tk::ButtonInvoke $data(cancelBtn)] - bind $w <Alt-d> [list focus $data(dirMenuBtn)] - + bind $w <Alt-Key> [list tk::AltKeyInDialog $w %A] # Set up event handlers specific to File or Directory Dialogs # @@ -1117,9 +1116,6 @@ static char updir_bits[] = { focus %s } } $data(typeMenuBtn) $data(typeMenuBtn)] - bind $w <Alt-n> [list focus $data(ent)] - bind $w <Alt-o> [list ::tk::dialog::file::InvokeBtn $w Open] - bind $w <Alt-s> [list ::tk::dialog::file::InvokeBtn $w Save] } else { set okCmd [list ::tk::dialog::file::chooseDir::OkCmd $w] bind $data(ent) <Return> $okCmd @@ -1150,13 +1146,12 @@ proc ::tk::dialog::file::SetSelectMode {w multi} { set dataName __tk_filedialog upvar ::tk::dialog::file::$dataName data if { $multi } { - set fNameCaption "[mc {File names:}]" + set fNameCaption "[mc {File &names:}]" } else { - set fNameCaption "[mc {File name:}]" + set fNameCaption "[mc {File &name:}]" } - set fNameUnder 5 set iconListCommand [list ::tk::dialog::file::OkCmd $w] - $w.f2.lab configure -text $fNameCaption -under $fNameUnder + ::tk::SetAmpText $w.f2.lab $fNameCaption ::tk::IconList_Config $data(icons) \ [list -multiple $multi -command $iconListCommand] return @@ -1307,19 +1302,19 @@ rSASvJTGhnhcV3EJlo3kh53ltF5nAhQAOw==}] # Restore the Open/Save Button if this is a File Dialog # if {[string equal $data(type) open]} { - $data(okBtn) config -text "[mc "Open"]" - set maxWidth [string length [mc "Open"]] - if {$maxWidth>[$data(okBtn) cget -width]} { - $data(okBtn) config -width $maxWidth - $data(cancelBtn) config -width $maxWidth - } + ::tk::SetAmpText $data(okBtn) [mc "&Open"] + set maxWidth [::tk::mcmaxamp [mc "&Open"]] + if {$maxWidth>[$data(okBtn) cget -width]} { + $data(okBtn) config -width $maxWidth + $data(cancelBtn) config -width $maxWidth + } } else { - $data(okBtn) config -text "[mc "Save"]" - set maxWidth [string length [mc "Save"]] - if {$maxWidth>[$data(okBtn) cget -width]} { - $data(okBtn) config -width $maxWidth - $data(cancelBtn) config -width $maxWidth - } + ::tk::SetAmpText $data(okBtn) [mc "&Save"] + set maxWidth [::tk::mcmaxamp [mc "&Save"]] + if {$maxWidth>[$data(okBtn) cget -width]} { + $data(okBtn) config -width $maxWidth + $data(cancelBtn) config -width $maxWidth + } } } @@ -1508,9 +1503,9 @@ proc ::tk::dialog::file::EntFocusIn {w} { if { [string equal [winfo class $w] TkFDialog] } { # If this is a File Dialog, make sure the buttons are labeled right. if {[string equal $data(type) open]} { - $data(okBtn) config -text "[mc "Open"]" + ::tk::SetAmpText $data(okBtn) [mc "&Open"] } else { - $data(okBtn) config -text "[mc "Save"]" + ::tk::SetAmpText $data(okBtn) [mc "&Save"] } } } @@ -1710,14 +1705,14 @@ proc ::tk::dialog::file::ListBrowse {w} { if { [string equal [winfo class $w] TkFDialog] } { if {[string equal $data(type) open]} { - $data(okBtn) config -text "[mc "Open"]" + ::tk::SetAmpText $data(okBtn) [mc "&Open"] } else { - $data(okBtn) config -text "[mc "Save"]" + ::tk::SetAmpText $data(okBtn) [mc "&Save"] } } } else { if { [string equal [winfo class $w] TkFDialog] } { - $data(okBtn) config -text "[mc "Open"]" + ::tk::SetAmpText $data(okBtn) [mc "&Open"] } } } |