threads / discuss / 10402

How to run git-gui always in English?

Subject: How to run git-gui always in English?

## tl;dr

11 messages between Oct 21, 2007 and Oct 30, 2007.

replies: 10people: 6as markdown or json

Steffen Prohaska· Oct 21, 2007, 06:47 UTC · lore

There are a lot of efforts going on to localize git-gui, including technical terms like "push". Personally I don't understand what this should be useful for. The command is called "git push"s. So, why should it be named differently in the gui.

Anyway, I can switch it off, right? So here's my question.

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.

Can I set an option in git-gui's option menu? I haven't found one.

	Steffen
Shawn O. Pearce· Oct 21, 2007, 06:52 UTC · re: Steffen Prohaska · lore

Re: How to run git-gui always in English?

Steffen Prohaska <prohaska@zib.de> wrote:
Show 17 quoted lines
> There are a lot of efforts going on to localize git-gui,
> including technical terms like "push". Personally I don't
> understand what this should be useful for. The command is called
> "git push"s. So, why should it be named differently in the gui.
> 
> Anyway, I can switch it off, right? So here's my question.
> 
> 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.
> 
> Can I set an option in git-gui's option menu? I haven't
> found one.

Yea, we don't have a UI to let you set what language the UI should appear in. Partly because once the UI is up we'd have to restart the entire process to change the strings its using. And partly because nobody has asked for this before.

I think that if you set LANG=en before you start git-gui it will take on English, and so will all of the standard dialogs that we "borrow" from wish.

-- 
Shawn.
Steffen Prohaska· Oct 21, 2007, 07:03 UTC · re: Shawn O. Pearce · lore

Re: How to run git-gui always in English?

On Oct 21, 2007, at 8:52 AM, Shawn O. Pearce wrote:
Show 22 quoted lines
> Steffen Prohaska <prohaska@zib.de> 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.
>>
>> Can I set an option in git-gui's option menu? I haven't
>> found one.
>>
>
> Yea, we don't have a UI to let you set what language the UI should
> appear in.  Partly because once the UI is up we'd have to restart
> the entire process to change the strings its using.  And partly
> because nobody has asked for this before.
>
> I think that if you set LANG=en before you start git-gui it will
> take on English, and so will all of the standard dialogs that we
> "borrow" from wish.

Hmm. I have no shell. I run git-gui from the Windows Start Menu. It directly runs wish to execute the Windows git-gui wrapper:

--- SNIP --- #!/bin/sh # Tcl ignores the next line -*- tcl -*- \ exec wish "$0" -- "$@"

if { $argc >=2 && [lindex $argv 0] == "--working-dir" } {
         cd [lindex $argv 1]
         set argv [lrange $argv 2 end]
         incr argc -2
}

set gitguidir [file dirname [info script]] regsub -all ";" $gitguidir "\\;" gitguidir set env(PATH) "$gitguidir;$env(PATH)" unset gitguidir

source [file join [file dirname [info script]] git-gui.tcl] --- SNIP ---

Do we have a chance before we source the real git-gui.tcl? Maybe we could "set env(LANG)" based on "git config gui.lang"? Or is it already too late because we needed to restart wish?

	Steffen
Shawn O. Pearce· Oct 21, 2007, 07:15 UTC · re: Steffen Prohaska · lore

Re: How to run git-gui always in English?

Steffen Prohaska <prohaska@zib.de> wrote:
Show 9 quoted lines
> On Oct 21, 2007, at 8:52 AM, Shawn O. Pearce wrote:
> >
> >I think that if you set LANG=en before you start git-gui it will
> >take on English, and so will all of the standard dialogs that we
> >"borrow" from wish.
> 
> Do we have a chance before we source the real git-gui.tcl?
> Maybe we could "set env(LANG)" based on "git config gui.lang"?
> Or is it already too late because we needed to restart wish?

Hmm. Really quick testing here shows that we just need to make sure env(LANG) is set before we do the msgcat::mcload call in git-gui.sh line 104.

If we're going to use a `git config gui.lang` thing then we can probably just make a msgcat::mclocale call on line 103 just before we load our message file. Unfortunately this is before we have located git so technically git-gui doesn't know how to run git-config and thus cannot get to gui.lang. :-|

Hmm. Looking at this further we may be able to insert the mclocale call at two locations; one at line 864 before we open the repository wizard, and again at line 1802, just before we start to initialize our UI. This does mean that for really serious errors (e.g. "No git in PATH") we'll be using your native OS language.

-- 
Shawn.
Steffen Prohaska· Oct 23, 2007, 20:00 UTC · re: Steffen Prohaska · lore

Re: How to run git-gui always in English?

On Oct 21, 2007, at 8:47 AM, Steffen Prohaska wrote:
Show 7 quoted lines
> 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?
	Steffen
Shawn O. Pearce· Oct 23, 2007, 22:45 UTC · re: Steffen Prohaska · lore

Re: How to run git-gui always in English?

Steffen Prohaska <prohaska@zib.de> wrote:
Show 16 quoted lines
> 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.
Peter Karlsson· Oct 26, 2007, 08:00 UTC · re: Steffen Prohaska · lore

Re: How to run git-gui always in English?

Steffen Prohaska:
> There are a lot of efforts going on to localize git-gui, including 
> technical terms like "push". Personally I don't understand what this 
> should be useful for. The command is called "git push"s. So, why should it 
> be named differently in the gui.

Not that I agree that "push" is a technical word, but perhaps you have a point. Why should there be such words in the GUI to start with? It's a GUI, trying to abstract away the command line. Why not have a button "Send" or a menu entry "Send changes to server", mimicing the "git push" command line option? Using command line names or showing protocol data directly in a user-oriented GUI is most often a bad idea.

Or perhaps what we need is an actual translation from "gitish" to English, which would have

msgid "Push" msgstr "Send changes to server"

?
-- 
\\// Peter - http://www.softwolves.pp.se/
Alex Riesen· Oct 26, 2007, 21:41 UTC · re: Peter Karlsson · lore

Re: How to run git-gui always in English?

Peter Karlsson, Fri, Oct 26, 2007 10:00:32 +0200:
Show 20 quoted lines
> Steffen Prohaska:
>
>> There are a lot of efforts going on to localize git-gui, including 
>> technical terms like "push". Personally I don't understand what this 
>> should be useful for. The command is called "git push"s. So, why should it 
>> be named differently in the gui.
>
> Not that I agree that "push" is a technical word, but perhaps you have a 
> point. Why should there be such words in the GUI to start with? It's a GUI, 
> trying to abstract away the command line. Why not have a button "Send" or a 
> menu entry "Send changes to server", mimicing the "git push" command line 
> option? Using command line names or showing protocol data directly in a 
> user-oriented GUI is most often a bad idea.
>
> Or perhaps what we need is an actual translation from "gitish" to English, 
> which would have
>
> msgid "Push"
> msgstr "Send changes to server"
>

Because you do not send changes to a _server_. There is no server. There is just another repo. Hence just "push"

Peter Karlsson· Oct 29, 2007, 12:58 UTC · re: Alex Riesen · lore

Re: How to run git-gui always in English?

Alex Riesen:
> Because you do not send changes to a _server_. There is no server. There 
> is just another repo. Hence just "push"

Fine. "Send to repository", then. My point is that if "push" is a technical term, then it doesn't belong in the GUI, and if it isn't, then it should be translated like any other UI element.

-- 
\\// Peter - http://www.softwolves.pp.se/
Junio C Hamano· Oct 30, 2007, 08:56 UTC · re: Peter Karlsson · lore

Re: How to run git-gui always in English?

Peter Karlsson <peter@softwolves.pp.se> writes:
Show 8 quoted lines
> Alex Riesen:
>
>> Because you do not send changes to a _server_. There is no
>> server. There is just another repo. Hence just "push"
>
> Fine. "Send to repository", then. My point is that if "push" is a
> technical term, then it doesn't belong in the GUI, and if it isn't,
> then it should be translated like any other UI element.

Why doesn't a "technical term" belong in the GUI in the first place?

If majority of people who use git know and use the term "push" to describe that concept, certainly they will be the people from whom the new people who start to use git (either from command line or from GUI) get help. Why do you want to have them use different language to make the communication more difficult?

Johannes Schindelin· Oct 30, 2007, 09:58 UTC · re: Peter Karlsson · lore

Re: How to run git-gui always in English?

Hi,
On Mon, 29 Oct 2007, Peter Karlsson wrote:
Show 8 quoted lines
> Alex Riesen:
> 
> > Because you do not send changes to a _server_. There is no server. There is
> > just another repo. Hence just "push"
> 
> Fine. "Send to repository", then. My point is that if "push" is a technical
> term, then it doesn't belong in the GUI, and if it isn't, then it should be
> translated like any other UI element.

Come on. "Byte" is a technical term, too, and only the French translate it. Same goes for "Computer". There is a point where hiding the truth from the user becomes silly. This is it.

Ciao, Dscho

← back to recent threads