git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/9] gitk i18n implementation: Import msgcat for message string translation; load translation catalogs.

From
Christian Stimming <stimming@tuhh.de>
Date
Nov 7, 2007, 17:40 UTC
Message-ID
<200711071840.59972.stimming@tuhh.de>
In-Reply-To
<200711071839.08570.stimming@tuhh.de>
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.
---
 gitk |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/gitk b/gitk
index 1da0b0a..629acfb 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
-- 
1.5.3.4.206.g58ba4
Previous: Christian StimmingNext: Christian Stimming
Message 2 of 13 in “gitk i18n implementation: Add Makefile with rules for po file creation and installation.”
  1. 1/9 gitk i18n implementation: Add Makefile with rules for po file creation and installation.Christian Stimming, Nov 7, 2007
  2. 2/9 gitk i18n implementation: Import msgcat for message string translation; load translation catalogs.Christian Stimming, Nov 7, 2007
  3. 3/9 gitk i18n implementation: Markup many strings for translation.Christian Stimming, Nov 7, 2007
  4. 4/9 gitk i18n: Initial German translation.Christian Stimming, Nov 7, 2007
  5. 5/9 gitk i18n: More i18n markup: findtype options menu.Christian Stimming, Nov 7, 2007
  6. 6/9 gitk i18n: More i18n markup: highlight_related and selectedhlview options menu.Christian Stimming, Nov 7, 2007
  7. 7/9 gitk i18n: More i18n markup: findloc optionmenu.Christian Stimming, Nov 7, 2007
  8. 8/9 gitk i18n: More i18n markup: gdttype optionmenu.Christian Stimming, Nov 7, 2007
  9. 9/9 gitk i18n: Recode gitk from latin1 to utf8 so that the (c) copyright character is valid utf8.Christian Stimming, Nov 7, 2007
  10. Paul MackerrasDec 11, 2007
  11. Christian StimmingDec 12, 2007
  12. Junio C HamanoNov 7, 2007
  13. Christian StimmingNov 7, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.