summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-09-12 20:47:06 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-09-12 20:47:06 (GMT)
commit146d73a365c3a1c2e61e646a929a5168ffb2810c (patch)
tree309296b742f8e8a95ac4d8b1e6da4bc396f62c24
parentc8dd7f62e8b335681099cdcec2b01aeaad646813 (diff)
downloadgit-146d73a365c3a1c2e61e646a929a5168ffb2810c.zip
git-146d73a365c3a1c2e61e646a929a5168ffb2810c.tar.gz
git-146d73a365c3a1c2e61e646a929a5168ffb2810c.tar.bz2
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>
-rwxr-xr-xgit-gui.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/git-gui.sh b/git-gui.sh
index afee777..d00758e 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -86,7 +86,16 @@ if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} {
## http://www.gnu.org/software/gettext/manual/html_node/Tcl.html
package require msgcat
-namespace import ::msgcat::mc
+
+proc mc {fmt args} {
+ set fmt [::msgcat::mc $fmt]
+ set cmk [string first @@ $fmt]
+ if {$cmk > 0} {
+ set fmt [string range $fmt 0 [expr {$cmk - 1}]]
+ }
+ return [eval [list format $fmt] $args]
+}
+
::msgcat::mcload $oguimsg
unset oguimsg