git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Steffen Prohaska <prohaska@zib.de>
Cc: Git Mailing List <git@vger.kernel.org>,
	msysGit <msysgit@googlegroups.com>
Subject: Re: How to run git-gui always in English?
Date: Tue, 23 Oct 2007 18:45:38 -0400	[thread overview]
Message-ID: <20071023224537.GH14735@spearce.org> (raw)
In-Reply-To: <5AD0C329-7136-42A3-9202-865E70A29B65@zib.de>

Steffen Prohaska <prohaska@zib.de> wrote:
> On Oct 21, 2007, at 8:47 AM, Steffen Prohaska wrote:
> 
> >How can I switch msysgit's git-gui to English, independently of
> >the language selected for Windows? I recognized that git-gui
> >adjusts to the 'language selection' of Windows. How can I
> >disable this? I want git-gui to always display English. Nothing
> >else, never! I can't help people who use a different language
> >in the gui, because I'll not understand what they are talking
> >about and they'll not understand me.
> 
> And it's even worse. An error in the localization can completely
> break git-gui. Apparently the German localization included in
> msysgit's Git-1.5.3-preview20071019.exe _is_ broken (see
> attached png).
> 
> Shouldn't the localization code be a bit more fault tolerant?

Yes.  This is a possible workaround:

>From 410aa617e7ca8240500e90f0b0389bde7b7b40aa Mon Sep 17 00:00:00 2001
From: Shawn O. Pearce <spearce@spearce.org>
Date: Tue, 23 Oct 2007 18:44:55 -0400
Subject: [PATCH] git-gui: Protect against bad translation strings

If a translation string uses a format character we don't have an
argument for then it may throw an error when we attempt to format
the translation.  In this case switch back to the default format
that comes with the program (aka the English translation).

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 git-gui.sh |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/git-gui.sh b/git-gui.sh
index 38c6e59..a7227ac 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -88,13 +88,20 @@ if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} {
 
 package require msgcat
 
-proc mc {fmt args} {
-	set fmt [::msgcat::mc $fmt]
+proc _mc_trim {fmt} {
 	set cmk [string first @@ $fmt]
 	if {$cmk > 0} {
-		set fmt [string range $fmt 0 [expr {$cmk - 1}]]
+		return [string range $fmt 0 [expr {$cmk - 1}]]
 	}
-	return [eval [list format $fmt] $args]
+	return $fmt
+}
+
+proc mc {en_fmt args} {
+	set fmt [_mc_trim [::msgcat::mc $en_fmt]]
+	if {[catch {set msg [eval [list format $fmt] $args]} err]} {
+		set msg [eval [list format [_mc_trim $en_fmt]] $args]
+	}
+	return $msg
 }
 
 proc strcat {args} {
-- 
1.5.3.4.1324.ga7925



-- 
Shawn.

  reply	other threads:[~2007-10-23 22:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-21  6:47 How to run git-gui always in English? Steffen Prohaska
2007-10-21  6:52 ` Shawn O. Pearce
2007-10-21  7:03   ` Steffen Prohaska
2007-10-21  7:15     ` Shawn O. Pearce
2007-10-23 20:00 ` Steffen Prohaska
2007-10-23 22:45   ` Shawn O. Pearce [this message]
2007-10-26  8:00 ` Peter Karlsson
2007-10-26 21:41   ` Alex Riesen
2007-10-29 12:58     ` Peter Karlsson
2007-10-30  8:56       ` Junio C Hamano
2007-10-30  9:58       ` Johannes Schindelin

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=20071023224537.GH14735@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=msysgit@googlegroups.com \
    --cc=prohaska@zib.de \
    /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;
as well as URLs for NNTP newsgroup(s).