Git development
 help / color / mirror / Atom feed
From: Christian Stimming <stimming@tuhh.de>
To: Brett Schwarz <brett_schwarz@yahoo.com>
Cc: Paul Mackerras <paulus@samba.org>, git@vger.kernel.org
Subject: Re: [PATCH 1/2] gitk: Import msgcat for translation support
Date: Sat, 28 Jul 2007 12:40:17 +0200	[thread overview]
Message-ID: <200707281240.17915.stimming@tuhh.de> (raw)
In-Reply-To: <157938.79347.qm@web38908.mail.mud.yahoo.com>

Am Samstag, 28. Juli 2007 09:28 schrieb Brett Schwarz:
> > > Import tcl's msgcat package to have the [mc...] procedure for
> > > translation available.
> >
> > if {[catch {
> >     package require msgcat
> >     # rest of your new stuff
> > }]} {
> >     proc mc {str} {
> >     return $str
> >     }
> > }
> >
> > so that everything still works if msgcat isn't available.  
>
> Junio already replied to this, and he was correct. 

The conclusion is that tcl8.1 is old enough so that you can safely assume 
msgcat exists? Or rather: Gitk probably requires tcl8.1 anyway (is there a 
known required tcl version for gitk?), and hence this can be relied upon here 
as well.

> However, this made me 
> think of something (that probably should be in git-gui as well) to make it
> a little more robust. We should check that the msg directory is where we
> think it is, and either give a warning, or exit the app (I would vote for
> the former).

>From what I've seen during testing, if the directory passed to msgload doesn't 
exists, the function simply does nothing. Its documentation doesn't say what 
is going to happen on a non-existing directory, though:
http://www.tcl.tk/man/tcl8.4/TclCmd/msgcat.htm#M10

> set msgdir [file join . msgs]      ;# or whatever this turns out to be
> if {[file exists $msgdir]} {
>     ::msgcat::mcload $msgdir
> } else {
>     puts stderr "WTF: can't find message catalog directory"
> }
>
> Or you could just use [catch] around the ::msgcat::mcload too.

I don't think [catch] changes anything, as the function rather seems to be 
no-op on nonexisting directory. So I think this wouldn't 
improve "robustness". I think this would only help in order to point out to 
the user that no translation has been found; however, it can't be known at 
this point whether this happens only because no translation exists, or 
whether there was some error in the installation. Probably only the latter is 
actually interesting to the user. 

Well, in conclusion I think the msgcat function is already robust enough and 
neither [catch] nor the directory checking buys us anything here.

Christian

  reply	other threads:[~2007-07-28 10:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-28  7:28 [PATCH 1/2] gitk: Import msgcat for translation support Brett Schwarz
2007-07-28 10:40 ` Christian Stimming [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-07-27 14:53 Christian Stimming
2007-07-27 23:53 ` Paul Mackerras

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200707281240.17915.stimming@tuhh.de \
    --to=stimming@tuhh.de \
    --cc=brett_schwarz@yahoo.com \
    --cc=git@vger.kernel.org \
    --cc=paulus@samba.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox