@matheusbsbs / matheus-bagliano / commits / a8139888f8
Fork 0

git-gui: Refactor current branch menu items to make i18n easier

The i18n team has also identified a rather ugly block of code in git-gui that is used to make a pair of Repository menu items show the current branch name. This code is difficult to convert to use [mc ...] to lookup the translation, so I'm refactoring it into a procedure. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Jul 23, 2007 at 01:11 UTC a8139888f8d250c6d173ddbe892e98fc49763702
1 file changed +11 -2
git-gui.sh
+11 -2
@@ -1682,7 +1682,7 @@ menu .mbar.repository
1682 .mbar.repository add command \
1683 -label {Browse Current Branch's Files} \
1684 -command {browser::new $current_branch}
1685 -trace add variable current_branch write ".mbar.repository entryconf [.mbar.repository index last] -label \"Browse \$current_branch's Files\" ;#"
1685 +set ui_browse_current [.mbar.repository index last]
1686 .mbar.repository add command \
1687 -label {Browse Branch Files...} \
1688 -command browser_open::dialog
@@ -1691,12 +1691,21 @@ trace add variable current_branch write ".mbar.repository entryconf [.mbar.repos
1691 .mbar.repository add command \
1692 -label {Visualize Current Branch's History} \
1693 -command {do_gitk $current_branch}
1694 -trace add variable current_branch write ".mbar.repository entryconf [.mbar.repository index last] -label \"Visualize \$current_branch's History\" ;#"
1694 +set ui_visualize_current [.mbar.repository index last]
1695 .mbar.repository add command \
1696 -label {Visualize All Branch History} \
1697 -command {do_gitk --all}
1698 .mbar.repository add separator
1699
1700 +proc current_branch_write {args} {
1701 + global current_branch
1702 + .mbar.repository entryconf $::ui_browse_current \
1703 + -label "Browse $current_branch's Files"
1704 + .mbar.repository entryconf $::ui_visualize_current \
1705 + -label "Visualize $current_branch's History"
1706 +}
1707 +trace add variable current_branch write current_branch_write
1708 +
1709 if {[is_enabled multicommit]} {
1710 .mbar.repository add command -label {Database Statistics} \
1711 -command do_stats