Merge branch 'cs/de'
[gitweb.git] / lib / option.tcl
index 17fcc65f78b5e09b77738508ca4db76d9a05a8f0..f812e5e89a1f21e2ee96a90e83958a472539bdd5 100644 (file)
@@ -15,6 +15,9 @@ proc save_config {} {
                font configure ${font}bold \
                        -family $global_config_new(gui.$font^^family) \
                        -size $global_config_new(gui.$font^^size)
+               font configure ${font}italic \
+                       -family $global_config_new(gui.$font^^family) \
+                       -size $global_config_new(gui.$font^^size)
                set global_config_new(gui.$name) [font configure $font]
                unset global_config_new(gui.$font^^family)
                unset global_config_new(gui.$font^^size)
@@ -51,71 +54,6 @@ proc save_config {} {
        }
 }
 
-proc do_about {} {
-       global appvers copyright
-       global tcl_patchLevel tk_patchLevel
-
-       set w .about_dialog
-       toplevel $w
-       wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
-
-       label $w.header -text "About [appname]" \
-               -font font_uibold
-       pack $w.header -side top -fill x
-
-       frame $w.buttons
-       button $w.buttons.close -text {Close} \
-               -default active \
-               -command [list destroy $w]
-       pack $w.buttons.close -side right
-       pack $w.buttons -side bottom -fill x -pady 10 -padx 10
-
-       label $w.desc \
-               -text "git-gui - a graphical user interface for Git.
-$copyright" \
-               -padx 5 -pady 5 \
-               -justify left \
-               -anchor w \
-               -borderwidth 1 \
-               -relief solid
-       pack $w.desc -side top -fill x -padx 5 -pady 5
-
-       set v {}
-       append v "git-gui version $appvers\n"
-       append v "[git version]\n"
-       append v "\n"
-       if {$tcl_patchLevel eq $tk_patchLevel} {
-               append v "Tcl/Tk version $tcl_patchLevel"
-       } else {
-               append v "Tcl version $tcl_patchLevel"
-               append v ", Tk version $tk_patchLevel"
-       }
-
-       label $w.vers \
-               -text $v \
-               -padx 5 -pady 5 \
-               -justify left \
-               -anchor w \
-               -borderwidth 1 \
-               -relief solid
-       pack $w.vers -side top -fill x -padx 5 -pady 5
-
-       menu $w.ctxm -tearoff 0
-       $w.ctxm add command \
-               -label {Copy} \
-               -command "
-               clipboard clear
-               clipboard append -format STRING -type STRING -- \[$w.vers cget -text\]
-       "
-
-       bind $w <Visibility> "grab $w; focus $w.buttons.close"
-       bind $w <Key-Escape> "destroy $w"
-       bind $w <Key-Return> "destroy $w"
-       bind_button3 $w.vers "tk_popup $w.ctxm %X %Y; grab $w; focus $w"
-       wm title $w "About [appname]"
-       tkwait window $w
-}
-
 proc do_options {} {
        global repo_config global_config font_descs
        global repo_config_new global_config_new
@@ -140,45 +78,44 @@ proc do_options {} {
        toplevel $w
        wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
 
-       label $w.header -text "Options" \
-               -font font_uibold
-       pack $w.header -side top -fill x
-
        frame $w.buttons
-       button $w.buttons.restore -text {Restore Defaults} \
+       button $w.buttons.restore -text [mc "Restore Defaults"] \
                -default normal \
                -command do_restore_defaults
        pack $w.buttons.restore -side left
-       button $w.buttons.save -text Save \
+       button $w.buttons.save -text [mc Save] \
                -default active \
                -command [list do_save_config $w]
        pack $w.buttons.save -side right
-       button $w.buttons.cancel -text {Cancel} \
+       button $w.buttons.cancel -text [mc "Cancel"] \
                -default normal \
                -command [list destroy $w]
        pack $w.buttons.cancel -side right -padx 5
        pack $w.buttons -side bottom -fill x -pady 10 -padx 10
 
-       labelframe $w.repo -text "[reponame] Repository"
-       labelframe $w.global -text {Global (All Repositories)}
+       labelframe $w.repo -text [mc "%s Repository" [reponame]]
+       labelframe $w.global -text [mc "Global (All Repositories)"]
        pack $w.repo -side left -fill both -expand 1 -pady 5 -padx 5
        pack $w.global -side right -fill both -expand 1 -pady 5 -padx 5
 
        set optid 0
        foreach option {
-               {t user.name {User Name}}
-               {t user.email {Email Address}}
-
-               {b merge.summary {Summarize Merge Commits}}
-               {i-1..5 merge.verbosity {Merge Verbosity}}
-
-               {b gui.trustmtime  {Trust File Modification Timestamps}}
-               {i-1..99 gui.diffcontext {Number of Diff Context Lines}}
-               {t gui.newbranchtemplate {New Branch Name Template}}
+               {t user.name {mc "User Name"}}
+               {t user.email {mc "Email Address"}}
+
+               {b merge.summary {mc "Summarize Merge Commits"}}
+               {i-1..5 merge.verbosity {mc "Merge Verbosity"}}
+               {b merge.diffstat {mc "Show Diffstat After Merge"}}
+
+               {b gui.trustmtime  {mc "Trust File Modification Timestamps"}}
+               {b gui.pruneduringfetch {mc "Prune Tracking Branches During Fetch"}}
+               {b gui.matchtrackingbranch {mc "Match Tracking Branches"}}
+               {i-0..99 gui.diffcontext {mc "Number of Diff Context Lines"}}
+               {t gui.newbranchtemplate {mc "New Branch Name Template"}}
                } {
                set type [lindex $option 0]
                set name [lindex $option 1]
-               set text [lindex $option 2]
+               set text [eval [lindex $option 2]]
                incr optid
                foreach f {repo global} {
                        switch -glob -- $type {
@@ -226,7 +163,7 @@ proc do_options {} {
        foreach option $font_descs {
                set name [lindex $option 0]
                set font [lindex $option 1]
-               set text [lindex $option 2]
+               set text [eval [lindex $option 2]]
 
                set global_config_new(gui.$font^^family) \
                        [font configure $font -family]
@@ -235,24 +172,36 @@ proc do_options {} {
 
                frame $w.global.$name
                label $w.global.$name.l -text "$text:"
-               pack $w.global.$name.l -side left -anchor w -fill x
-               eval tk_optionMenu $w.global.$name.family \
-                       global_config_new(gui.$font^^family) \
-                       $all_fonts
-               spinbox $w.global.$name.size \
-                       -textvariable global_config_new(gui.$font^^size) \
-                       -from 2 -to 80 -increment 1 \
-                       -width 3
-               bind $w.global.$name.size <FocusIn> {%W selection range 0 end}
-               pack $w.global.$name.size -side right -anchor e
-               pack $w.global.$name.family -side right -anchor e
+               button $w.global.$name.b \
+                       -text [mc "Change Font"] \
+                       -command [list \
+                               choose_font::pick \
+                               $w \
+                               [mc "Choose %s" $text] \
+                               global_config_new(gui.$font^^family) \
+                               global_config_new(gui.$font^^size) \
+                               ]
+               label $w.global.$name.f -textvariable global_config_new(gui.$font^^family)
+               label $w.global.$name.s -textvariable global_config_new(gui.$font^^size)
+               label $w.global.$name.pt -text [mc "pt."]
+               pack $w.global.$name.l -side left -anchor w
+               pack $w.global.$name.b -side right -anchor e
+               pack $w.global.$name.pt -side right -anchor w
+               pack $w.global.$name.s -side right -anchor w
+               pack $w.global.$name.f -side right -anchor w
                pack $w.global.$name -side top -anchor w -fill x
        }
 
        bind $w <Visibility> "grab $w; focus $w.buttons.save"
        bind $w <Key-Escape> "destroy $w"
        bind $w <Key-Return> [list do_save_config $w]
-       wm title $w "[appname] ([reponame]): Options"
+
+       if {[is_MacOSX]} {
+               set t [mc "Preferences"]
+       } else {
+               set t [mc "Options"]
+       }
+       wm title $w "[appname] ([reponame]): $t"
        tkwait window $w
 }
 
@@ -283,7 +232,7 @@ proc do_restore_defaults {} {
 
 proc do_save_config {w} {
        if {[catch {save_config} err]} {
-               error_popup "Failed to completely save options:\n\n$err"
+               error_popup [strcat [mc "Failed to completely save options:"] "\n\n$err"]
        }
        reshow_diff
        destroy $w