aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Stimming <stimming@tuhh.de>2007-11-07 18:40:59 +0100
committerPaul Mackerras <paulus@samba.org>2007-12-20 10:19:07 +1100
commit663c3aa9c89ae7d7a52308c50bda084f8b4ab337 (patch)
treef4c28e62dea02502e43fb8a41f37d9b38ef46f37
parent25ec9384844d0cc855cf16672f61cf6b3be9f67d (diff)
downloadgit-663c3aa9c89ae7d7a52308c50bda084f8b4ab337.tar.gz
git-663c3aa9c89ae7d7a52308c50bda084f8b4ab337.tar.xz
[PATCH] gitk i18n: Import msgcat for message string translation; load translation catalogs
By setting the environment variable GITK_MSGSDIR, one can manually set the directory where the .msg files are located. This is quite handy during development with GITK_MSGSDIR=po. Signed-off-by: Christian Stimming <stimming@tuhh.de> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rwxr-xr-xgitk19
1 files changed, 19 insertions, 0 deletions
diff --git a/gitk b/gitk
index 1da0b0af1..629acfbcc 100755
--- a/gitk
+++ b/gitk
@@ -8476,6 +8476,25 @@ set diffcolors {red "#00a000" blue}
set diffcontext 3
set selectbgcolor gray85
+## For msgcat loading, first locate the installation location.
+if { [info exists ::env(GITK_MSGSDIR)] } {
+ ## Msgsdir was manually set in the environment.
+ set gitk_msgsdir $::env(GITK_MSGSDIR)
+} else {
+ ## Let's guess the prefix from argv0.
+ set gitk_prefix [file dirname [file dirname [file normalize $argv0]]]
+ set gitk_libdir [file join $gitk_prefix share gitk lib]
+ set gitk_msgsdir [file join $gitk_libdir msgs]
+ unset gitk_prefix
+}
+
+## Internationalization (i18n) through msgcat and gettext. See
+## http://www.gnu.org/software/gettext/manual/html_node/Tcl.html
+package require msgcat
+namespace import ::msgcat::mc
+## And eventually load the actual message catalog
+::msgcat::mcload $gitk_msgsdir
+
catch {source ~/.gitk}
font create optionfont -family sans-serif -size -12