@matheusbsbs / matheus-bagliano / commits / 663c3aa9c8
Fork 0

[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>

Christian Stimming committed Nov 7, 2007 at 18:40 UTC 663c3aa9c89ae7d7a52308c50bda084f8b4ab337
1 file changed +19
gitk
+19
@@ -8476,6 +8476,25 @@ set diffcolors {red "#00a000" blue}
8476 set diffcontext 3
8477 set selectbgcolor gray85
8478
8479 +## For msgcat loading, first locate the installation location.
8480 +if { [info exists ::env(GITK_MSGSDIR)] } {
8481 + ## Msgsdir was manually set in the environment.
8482 + set gitk_msgsdir $::env(GITK_MSGSDIR)
8483 +} else {
8484 + ## Let's guess the prefix from argv0.
8485 + set gitk_prefix [file dirname [file dirname [file normalize $argv0]]]
8486 + set gitk_libdir [file join $gitk_prefix share gitk lib]
8487 + set gitk_msgsdir [file join $gitk_libdir msgs]
8488 + unset gitk_prefix
8489 +}
8490 +
8491 +## Internationalization (i18n) through msgcat and gettext. See
8492 +## http://www.gnu.org/software/gettext/manual/html_node/Tcl.html
8493 +package require msgcat
8494 +namespace import ::msgcat::mc
8495 +## And eventually load the actual message catalog
8496 +::msgcat::mcload $gitk_msgsdir
8497 +
8498 catch {source ~/.gitk}
8499
8500 font create optionfont -family sans-serif -size -12