{"thread":{"id":"9271","subject":"Re: [PATCH 1/2] gitk: Import msgcat for translation support","startedAt":"2007-07-28T07:28:10Z","lastAt":"2007-07-28T10:40:17Z","messageCount":2,"participants":["Brett Schwarz","Christian Stimming"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"48874","messageId":"157938.79347.qm@web38908.mail.mud.yahoo.com","threadId":"9271","inReplyTo":null,"subject":"Re: [PATCH 1/2] gitk: Import msgcat for translation support","fromName":"Brett Schwarz","fromEmail":"brett_schwarz@yahoo.com","sentAt":"2007-07-28T07:28:10Z","receivedAt":"2007-07-28T07:28:10Z","isPatch":true,"sender":{"key":"brett_schwarz@yahoo.com","avatar":null},"body":"> \n> ----- Original Message ----\n> From: Paul Mackerras <paulus@samba.org>\n> To: Christian Stimming <stimming@tuhh.de>\n> Cc: git@vger.kernel.org\n> Sent: Friday, July 27, 2007 4:53:28 PM\n> Subject: Re: [PATCH 1/2] gitk: Import msgcat for translation support\n> \n> Christian Stimming writes:\n> \n> > Import tcl's msgcat package to have the [mc...] procedure for  \n> > translation available.\n> \n> I would prefer\n> \n> if {[catch {\n>     package require msgcat\n>     # rest of your new stuff\n> }]} {\n>     proc mc {str} {\n>     return $str\n>     }\n> }\n> \n> so that everything still works if msgcat isn't available.  In other\n> words I don't want to introduce a possible regression by increasing\n> gitk's requirements.\n\nJunio already replied to this, and he was correct. However, this made me think\nof something (that probably should be in git-gui as well) to make it a little\nmore robust. We should check that the msg directory is where we think it is,\nand either give a warning, or exit the app (I would vote for the former).\n\nSo, something like:\n\nset msgdir [file join . msgs]      ;# or whatever this turns out to be\nif {[file exists $msgdir]} {\n    ::msgcat::mcload $msgdir\n} else {\n    puts stderr \"WTF: can't find message catalog directory\"\n}\n\nOr you could just use [catch] around the ::msgcat::mcload too.\n\n\nRegards,\n    --brett\n\n\n\n\n       \n____________________________________________________________________________________\nMoody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games.\nhttp://sims.yahoo.com/  \n"},{"id":"48894","messageId":"200707281240.17915.stimming@tuhh.de","threadId":"9271","inReplyTo":"157938.79347.qm@web38908.mail.mud.yahoo.com","subject":"Re: [PATCH 1/2] gitk: Import msgcat for translation support","fromName":"Christian Stimming","fromEmail":"stimming@tuhh.de","sentAt":"2007-07-28T10:40:17Z","receivedAt":"2007-07-28T10:40:17Z","isPatch":true,"sender":{"key":"stimming@tuhh.de","avatar":"https://avatars.githubusercontent.com/u/227778?v=4"},"body":"Am Samstag, 28. Juli 2007 09:28 schrieb Brett Schwarz:\n> > > Import tcl's msgcat package to have the [mc...] procedure for\n> > > translation available.\n> >\n> > if {[catch {\n> >     package require msgcat\n> >     # rest of your new stuff\n> > }]} {\n> >     proc mc {str} {\n> >     return $str\n> >     }\n> > }\n> >\n> > so that everything still works if msgcat isn't available.  \n>\n> Junio already replied to this, and he was correct. \n\nThe conclusion is that tcl8.1 is old enough so that you can safely assume \nmsgcat exists? Or rather: Gitk probably requires tcl8.1 anyway (is there a \nknown required tcl version for gitk?), and hence this can be relied upon here \nas well.\n\n> However, this made me \n> think of something (that probably should be in git-gui as well) to make it\n> a little more robust. We should check that the msg directory is where we\n> think it is, and either give a warning, or exit the app (I would vote for\n> the former).\n\n>From what I've seen during testing, if the directory passed to msgload doesn't \nexists, the function simply does nothing. Its documentation doesn't say what \nis going to happen on a non-existing directory, though:\nhttp://www.tcl.tk/man/tcl8.4/TclCmd/msgcat.htm#M10\n\n> set msgdir [file join . msgs]      ;# or whatever this turns out to be\n> if {[file exists $msgdir]} {\n>     ::msgcat::mcload $msgdir\n> } else {\n>     puts stderr \"WTF: can't find message catalog directory\"\n> }\n>\n> Or you could just use [catch] around the ::msgcat::mcload too.\n\nI don't think [catch] changes anything, as the function rather seems to be \nno-op on nonexisting directory. So I think this wouldn't \nimprove \"robustness\". I think this would only help in order to point out to \nthe user that no translation has been found; however, it can't be known at \nthis point whether this happens only because no translation exists, or \nwhether there was some error in the installation. Probably only the latter is \nactually interesting to the user. \n\nWell, in conclusion I think the msgcat function is already robust enough and \nneither [catch] nor the directory checking buys us anything here.\n\nChristian\n"}]}