From: "Shawn O. Pearce" <spearce@spearce.org>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Christian Stimming <stimming@tuhh.de>,
Miklos Vajna <vmiklos@frugalware.org>,
Nanako Shiraishi <nanako3@bluebottle.com>,
Michele Ballabio <barra_cuda@katamail.com>,
Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com>,
Xudong Guan <xudong.guan@gmail.com>,
Harri Ilari Tapio Liusvaara <hliusvaa@cc.hut.fi>,
Junio C Hamano <gitster@pobox.com>,
Irina Riesen <irina.riesen@gmail.com>,
git@vger.kernel.org
Subject: Re: git-gui i18n status?
Date: Sat, 1 Sep 2007 22:24:44 -0400 [thread overview]
Message-ID: <20070902022444.GK18160@spearce.org> (raw)
In-Reply-To: <20070902014242.GJ18160@spearce.org>
"Shawn O. Pearce" <spearce@spearce.org> wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > Hmm. I am not enough involved in i18n stuff to form a proper opinion
> > here... Do you suggest to move the initialisation earlier?
>
> Yea, I think that's what we are going to have to do here. If we don't
> setup the directory for the .msg files early enough than we cannot do
> translations through [mc]. Unfortunately that means we have to also
> break up the library initialization.
>
> I'll try to work up a patch that does this.
This two patch series is based on my current master (gitgui-0.8.2).
Its also now in my pu branch.
>From fc703c209d415fe20ad5551465b5b68b8ab8b046 Mon Sep 17 00:00:00 2001
From: Shawn O. Pearce <spearce@spearce.org>
Date: Sat, 1 Sep 2007 21:58:29 -0400
Subject: [PATCH] git-gui: Locate the library directory early during startup
To support a localized version of git-gui we need to locate the
library directory early so we can initialize Tcl's msgcat package
to load translated messages from. This needs to occur before we
declare our git-version proc so that errors related to locating
git or assessing its version can be reported to the end-user in
their preferred language. However we have to keep the library
loading until after git-version has been declared, otherwise we
will fail to start git-gui if we are using a fake tclIndex that
was generated by our Makefile.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
git-gui.sh | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/git-gui.sh b/git-gui.sh
index fa30ccc..4ea6e91 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -44,6 +44,20 @@ if {[catch {package require Tcl 8.4} err]
######################################################################
##
+## locate our library
+
+set oguilib {@@GITGUI_LIBDIR@@}
+set oguirel {@@GITGUI_RELATIVE@@}
+if {$oguirel eq {1}} {
+ set oguilib [file dirname [file dirname [file normalize $argv0]]]
+ set oguilib [file join $oguilib share git-gui lib]
+} elseif {[string match @@* $oguirel]} {
+ set oguilib [file join [file dirname [file normalize $argv0]] lib]
+}
+unset oguirel
+
+######################################################################
+##
## enable verbose loading?
if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} {
@@ -595,15 +609,6 @@ You are using [git-version]:
##
## configure our library
-set oguilib {@@GITGUI_LIBDIR@@}
-set oguirel {@@GITGUI_RELATIVE@@}
-if {$oguirel eq {1}} {
- set oguilib [file dirname [file dirname [file normalize $argv0]]]
- set oguilib [file join $oguilib share git-gui lib]
-} elseif {[string match @@* $oguirel]} {
- set oguilib [file join [file dirname [file normalize $argv0]] lib]
-}
-
set idx [file join $oguilib tclIndex]
if {[catch {set fd [open $idx r]} err]} {
catch {wm withdraw .}
@@ -637,7 +642,7 @@ if {$idx ne {}} {
} else {
set auto_path [concat [list $oguilib] $auto_path]
}
-unset -nocomplain oguirel idx fd
+unset -nocomplain idx fd
######################################################################
##
--
1.5.3.rc7.30.g947ad2
>From d4b0ccd931cc29f35e8f8493445af27ea72ed03e Mon Sep 17 00:00:00 2001
From: Shawn O. Pearce <spearce@spearce.org>
Date: Sat, 1 Sep 2007 22:22:42 -0400
Subject: [PATCH] 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>
---
git-gui.sh | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/git-gui.sh b/git-gui.sh
index 4ea6e91..486d36e 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -51,8 +51,12 @@ set oguirel {@@GITGUI_RELATIVE@@}
if {$oguirel eq {1}} {
set oguilib [file dirname [file dirname [file normalize $argv0]]]
set oguilib [file join $oguilib share git-gui lib]
+ set oguimsg [file join $oguilib msgs]
} elseif {[string match @@* $oguirel]} {
set oguilib [file join [file dirname [file normalize $argv0]] lib]
+ set oguimsg [file join [file dirname [file normalize $argv0]] po]
+} else {
+ set oguimsg [file join $oguilib msgs]
}
unset oguirel
@@ -76,6 +80,16 @@ if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} {
######################################################################
##
+## 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
+::msgcat::mcload $oguimsg
+unset oguimsg
+
+######################################################################
+##
## read only globals
set _appname [lindex [file split $argv0] end]
--
1.5.3.rc7.30.g947ad2
--
Shawn.
next prev parent reply other threads:[~2007-09-02 2:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-01 4:29 git-gui i18n status? Shawn O. Pearce
2007-09-01 23:42 ` Johannes Schindelin
2007-09-02 1:00 ` Junio C Hamano
2007-09-02 1:42 ` Shawn O. Pearce
2007-09-02 2:24 ` Shawn O. Pearce [this message]
2007-09-02 12:20 ` Johannes Schindelin
2007-09-16 12:03 ` Christian Stimming
2007-09-17 3:20 ` Shawn O. Pearce
2007-09-17 9:04 ` Johannes Schindelin
2007-09-02 12:29 ` Johannes Schindelin
2007-09-02 14:17 ` Michele Ballabio
-- strict thread matches above, loose matches on Subject: below --
2007-09-02 15:09 Michele Ballabio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070902022444.GK18160@spearce.org \
--to=spearce@spearce.org \
--cc=Johannes.Schindelin@gmx.de \
--cc=barra_cuda@katamail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hliusvaa@cc.hut.fi \
--cc=irina.riesen@gmail.com \
--cc=nanako3@bluebottle.com \
--cc=paolo.ciarrocchi@gmail.com \
--cc=stimming@tuhh.de \
--cc=vmiklos@frugalware.org \
--cc=xudong.guan@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).