Skip to contentSkip to conversation

gitk: fix "Key bindings" message

PATCH Superseded Michele Ballabio 2 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gitk: fix "Key bindings" message

Fix string substitution. Now the "Key bindings" message under the "Help" menu is ready for translation.

---
 gitk |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)
gitk +16 -16
index 4a923af..871a006 100755
@@ -1309,7 +1309,7 @@ proc keys {} {
     message $w.m -text [mc "
 Gitk key bindings:
 
-<$M1T-Q>		Quit
+<%s-Q>		Quit
 <Home>		Move to first commit
 <End>		Move to last commit
 <Up>, p, i	Move up one commit
@@ -1318,12 +1318,12 @@ Gitk key bindings:
 <Right>, x, l	Go forward in history list
 <PageUp>	Move up one page in commit list
 <PageDown>	Move down one page in commit list
-<$M1T-Home>	Scroll to top of commit list
-<$M1T-End>	Scroll to bottom of commit list
-<$M1T-Up>	Scroll commit list up one line
-<$M1T-Down>	Scroll commit list down one line
-<$M1T-PageUp>	Scroll commit list up one page
-<$M1T-PageDown>	Scroll commit list down one page
+<%s-Home>	Scroll to top of commit list
+<%s-End>	Scroll to bottom of commit list
+<%s-Up>	Scroll commit list up one line
+<%s-Down>	Scroll commit list down one line
+<%s-PageUp>	Scroll commit list up one page
+<%s-PageDown>	Scroll commit list down one page
 <Shift-Up>	Find backwards (upwards, later commits)
 <Shift-Down>	Find forwards (downwards, earlier commits)
 <Delete>, b	Scroll diff view up one page
@@ -1331,20 +1331,20 @@ Gitk key bindings:
 <Space>		Scroll diff view down one page
 u		Scroll diff view up 18 lines
 d		Scroll diff view down 18 lines
-<$M1T-F>		Find
-<$M1T-G>		Move to next find hit
+<%s-F>		Find
+<%s-G>		Move to next find hit
 <Return>	Move to next find hit
 /		Move to next find hit, or redo find
 ?		Move to previous find hit
 f		Scroll diff view to next file
-<$M1T-S>		Search for next hit in diff view
-<$M1T-R>		Search for previous hit in diff view
-<$M1T-KP+>	Increase font size
-<$M1T-plus>	Increase font size
-<$M1T-KP->	Decrease font size
-<$M1T-minus>	Decrease font size
+<%s-S>		Search for next hit in diff view
+<%s-R>		Search for previous hit in diff view
+<%s-KP+>	Increase font size
+<%s-plus>	Increase font size
+<%s-KP->	Decrease font size
+<%s-minus>	Decrease font size
 <F5>		Update
-"] \
+" $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T ] \
 	    -justify left -bg white -border 2 -relief groove
     pack $w.m -side top -fill both -padx 2 -pady 2
     button $w.ok -text [mc "Close"] -command "destroy $w" -default active
Signature · 1 line
1.5.3.5
#1 lore raw
Quoted 2 lines · Michele Ballabio

-"] \
+" $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T ] \

Ick. Are you sure you have the right number of instances of $M1T? :)

I'd prefer to use [string map].

Actually, for translation, it would probably be better to bust up that help text into a series of shorter strings, maybe even one per line.

Paul.

#2 lore raw

PATCH v2 1/1 gitk: fix "Key bindings" message

Fix string substitution using 'string map'. Now the "Key bindings" menu is ready for translation.

---

Quoted 6 lines · Paul Mackerras
Quoted 2 lines · Michele Ballabio

-"] \
+" $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T $M1T ] \

Ick. Are you sure you have the right number of instances of $M1T? :)

Yes :^P. I was sure there was a better fix but didn't know where to look at.

Quoted 1 line

I'd prefer to use [string map].

This patch tries to do so. Is this correct?

Quoted 2 lines

Actually, for translation, it would probably be better to bust up that help text into a series of shorter strings, maybe even one per line.

Or split this by "topic": "scrolling", "search", "fonts", "history"...

 gitk |   34 +++++++++++++++++-----------------
 1 files changed, 17 insertions(+), 17 deletions(-)
gitk +17 -17
index 801a5a9..24796e1 100755
@@ -1306,10 +1306,10 @@ proc keys {} {
     }
     toplevel $w
     wm title $w [mc "Gitk key bindings"]
-    message $w.m -text [mc "
+    message $w.m -text [ string map "M1T $M1T" [ mc "
 Gitk key bindings:
 
-<$M1T-Q>		Quit
+<M1T-Q>		Quit
 <Home>		Move to first commit
 <End>		Move to last commit
 <Up>, p, i	Move up one commit
@@ -1318,12 +1318,12 @@ Gitk key bindings:
 <Right>, x, l	Go forward in history list
 <PageUp>	Move up one page in commit list
 <PageDown>	Move down one page in commit list
-<$M1T-Home>	Scroll to top of commit list
-<$M1T-End>	Scroll to bottom of commit list
-<$M1T-Up>	Scroll commit list up one line
-<$M1T-Down>	Scroll commit list down one line
-<$M1T-PageUp>	Scroll commit list up one page
-<$M1T-PageDown>	Scroll commit list down one page
+<M1T-Home>	Scroll to top of commit list
+<M1T-End>	Scroll to bottom of commit list
+<M1T-Up>	Scroll commit list up one line
+<M1T-Down>	Scroll commit list down one line
+<M1T-PageUp>	Scroll commit list up one page
+<M1T-PageDown>	Scroll commit list down one page
 <Shift-Up>	Find backwards (upwards, later commits)
 <Shift-Down>	Find forwards (downwards, earlier commits)
 <Delete>, b	Scroll diff view up one page
@@ -1331,20 +1331,20 @@ Gitk key bindings:
 <Space>		Scroll diff view down one page
 u		Scroll diff view up 18 lines
 d		Scroll diff view down 18 lines
-<$M1T-F>		Find
-<$M1T-G>		Move to next find hit
+<M1T-F>		Find
+<M1T-G>		Move to next find hit
 <Return>	Move to next find hit
 /		Move to next find hit, or redo find
 ?		Move to previous find hit
 f		Scroll diff view to next file
-<$M1T-S>		Search for next hit in diff view
-<$M1T-R>		Search for previous hit in diff view
-<$M1T-KP+>	Increase font size
-<$M1T-plus>	Increase font size
-<$M1T-KP->	Decrease font size
-<$M1T-minus>	Decrease font size
+<M1T-S>		Search for next hit in diff view
+<M1T-R>		Search for previous hit in diff view
+<M1T-KP+>	Increase font size
+<M1T-plus>	Increase font size
+<M1T-KP->	Decrease font size
+<M1T-minus>	Decrease font size
 <F5>		Update
-"] \
+" ] ] \
 	    -justify left -bg white -border 2 -relief groove
     pack $w.m -side top -fill both -padx 2 -pady 2
     button $w.ok -text [mc "Close"] -command "destroy $w" -default active
Signature · 1 line
1.5.3.5
#3 lore raw
Quoted 1 line · Michele Ballabio

This patch tries to do so. Is this correct?

Pretty good... I think that $M1T needs to be passed through [mc] as well, and I would tend to use [list M1T $M1T] rather than "M1T $M1T", but apart from that it's OK. I am wondering whether the help text needs to be busted up into individual lines for processing by [mc].

Paul.

#4 lore raw

PATCH v3 1/1 gitk: fix "Key bindings" message

The "Key bindings" message under the "Help" menu was too long and could not be parsed by the translation engine.

Fix both issues by translating one line at a time.

---

Quoted 2 lines · Paul Mackerras

I am wondering whether the help text
needs to be busted up into individual lines for processing by [mc].

Here it is. With this patch the strings do show up in po/gitk.pot.

 gitk |   78 +++++++++++++++++++++++++++++++++---------------------------------
 1 files changed, 39 insertions(+), 39 deletions(-)
gitk +39 -39
index 5560e4d..7555968 100755
@@ -1307,45 +1307,45 @@ proc keys {} {
     }
     toplevel $w
     wm title $w [mc "Gitk key bindings"]
-    message $w.m -text [mc "
-Gitk key bindings:
-
-<$M1T-Q>		Quit
-<Home>		Move to first commit
-<End>		Move to last commit
-<Up>, p, i	Move up one commit
-<Down>, n, k	Move down one commit
-<Left>, z, j	Go back in history list
-<Right>, x, l	Go forward in history list
-<PageUp>	Move up one page in commit list
-<PageDown>	Move down one page in commit list
-<$M1T-Home>	Scroll to top of commit list
-<$M1T-End>	Scroll to bottom of commit list
-<$M1T-Up>	Scroll commit list up one line
-<$M1T-Down>	Scroll commit list down one line
-<$M1T-PageUp>	Scroll commit list up one page
-<$M1T-PageDown>	Scroll commit list down one page
-<Shift-Up>	Find backwards (upwards, later commits)
-<Shift-Down>	Find forwards (downwards, earlier commits)
-<Delete>, b	Scroll diff view up one page
-<Backspace>	Scroll diff view up one page
-<Space>		Scroll diff view down one page
-u		Scroll diff view up 18 lines
-d		Scroll diff view down 18 lines
-<$M1T-F>		Find
-<$M1T-G>		Move to next find hit
-<Return>	Move to next find hit
-/		Move to next find hit, or redo find
-?		Move to previous find hit
-f		Scroll diff view to next file
-<$M1T-S>		Search for next hit in diff view
-<$M1T-R>		Search for previous hit in diff view
-<$M1T-KP+>	Increase font size
-<$M1T-plus>	Increase font size
-<$M1T-KP->	Decrease font size
-<$M1T-minus>	Decrease font size
-<F5>		Update
-"] \
+    message $w.m -text "
+[mc "Gitk key bindings:"]
+
+[mc "<%s-Q>		Quit" $M1T]
+[mc "<Home>		Move to first commit"]
+[mc "<End>		Move to last commit"]
+[mc "<Up>, p, i	Move up one commit"]
+[mc "<Down>, n, k	Move down one commit"]
+[mc "<Left>, z, j	Go back in history list"]
+[mc "<Right>, x, l	Go forward in history list"]
+[mc "<PageUp>	Move up one page in commit list"]
+[mc "<PageDown>	Move down one page in commit list"]
+[mc "<%s-Home>	Scroll to top of commit list" $M1T]
+[mc "<%s-End>	Scroll to bottom of commit list" $M1T]
+[mc "<%s-Up>	Scroll commit list up one line" $M1T]
+[mc "<%s-Down>	Scroll commit list down one line" $M1T]
+[mc "<%s-PageUp>	Scroll commit list up one page" $M1T]
+[mc "<%s-PageDown>	Scroll commit list down one page" $M1T]
+[mc "<Shift-Up>	Find backwards (upwards, later commits)"]
+[mc "<Shift-Down>	Find forwards (downwards, earlier commits)"]
+[mc "<Delete>, b	Scroll diff view up one page"]
+[mc "<Backspace>	Scroll diff view up one page"]
+[mc "<Space>		Scroll diff view down one page"]
+[mc "u		Scroll diff view up 18 lines"]
+[mc "d		Scroll diff view down 18 lines"]
+[mc "<%s-F>		Find" $M1T]
+[mc "<%s-G>		Move to next find hit" $M1T]
+[mc "<Return>	Move to next find hit"]
+[mc "/		Move to next find hit, or redo find"]
+[mc "?		Move to previous find hit"]
+[mc "f		Scroll diff view to next file"]
+[mc "<%s-S>		Search for next hit in diff view" $M1T]
+[mc "<%s-R>		Search for previous hit in diff view" $M1T]
+[mc "<%s-KP+>	Increase font size" $M1T]
+[mc "<%s-plus>	Increase font size" $M1T]
+[mc "<%s-KP->	Decrease font size" $M1T]
+[mc "<%s-minus>	Decrease font size" $M1T]
+[mc "<F5>		Update"]
+" \
 	    -justify left -bg white -border 2 -relief groove
     pack $w.m -side top -fill both -padx 2 -pady 2
     button $w.ok -text [mc "Close"] -command "destroy $w" -default active
Signature · 1 line
1.5.3.5