git-gui: Support context-sensitive i18n
Ocassionally, one would want to translate the same string used in different contexts in diffrent ways. This patch provides a wrapper for msgcat::mc that trims "@@" and anything coming after it, whether or not the string actually got translated. Proposed-by: Harri Ilari Tapio Liusvaara <hliusvaa@cc.hut.fi> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Sep 12, 2007 at 16:47 UTC
146d73a365c3a1c2e61e646a929a5168ffb2810c
1 file changed
+10
-1
git-gui.sh
+10
-1
@@ -86,7 +86,16 @@ if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} {
86
## http://www.gnu.org/software/gettext/manual/html_node/Tcl.html
87
88
package require msgcat
89
-namespace import ::msgcat::mc
89
+
90
+proc mc {fmt args} {
91
+ set fmt [::msgcat::mc $fmt]
92
+ set cmk [string first @@ $fmt]
93
+ if {$cmk > 0} {
94
+ set fmt [string range $fmt 0 [expr {$cmk - 1}]]
95
+ }
96
+ return [eval [list format $fmt] $args]
97
+}
98
+
99
::msgcat::mcload $oguimsg
100
unset oguimsg
101