@matheusbsbs / matheus-bagliano / commits / d4b0ccd931
Fork 0

git-gui: Initialize Tcl's msgcat library for internationalization

Tcl's msgcat library and corresponding mc procedure can locate a translated string for any user message, provided that it is first given a directory where the *.msg files are located containing the translations. During installation we will place the translations in lib/msgs/, so we need to inform msgcat of this location once we determine it during startup. Our source code tree however will store all of the translations within the po/ directory, so we need to special case this variant. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Sep 1, 2007 at 22:22 UTC d4b0ccd931cc29f35e8f8493445af27ea72ed03e
1 file changed +14
git-gui.sh
+14
@@ -51,8 +51,12 @@ set oguirel {@@GITGUI_RELATIVE@@}
51 if {$oguirel eq {1}} {
52 set oguilib [file dirname [file dirname [file normalize $argv0]]]
53 set oguilib [file join $oguilib share git-gui lib]
54 + set oguimsg [file join $oguilib msgs]
55 } elseif {[string match @@* $oguirel]} {
56 set oguilib [file join [file dirname [file normalize $argv0]] lib]
57 + set oguimsg [file join [file dirname [file normalize $argv0]] po]
58 +} else {
59 + set oguimsg [file join $oguilib msgs]
60 }
61 unset oguirel
62
@@ -74,6 +78,16 @@ if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} {
78 }
79 }
80
81 +######################################################################
82 +##
83 +## Internationalization (i18n) through msgcat and gettext. See
84 +## http://www.gnu.org/software/gettext/manual/html_node/Tcl.html
85 +
86 +package require msgcat
87 +namespace import ::msgcat::mc
88 +::msgcat::mcload $oguimsg
89 +unset oguimsg
90 +
91 ######################################################################
92 ##
93 ## read only globals