How to run git-gui always in English?

10 messages, 5 authors, 2016-06-15 · open the first message on its own page

How to run git-gui always in English?

From: Steffen Prohaska <hidden>
Date: 2016-06-15 22:43:43

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

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

From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:43:43

Steffen Prohaska [off-list ref] wrote:
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.

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

From: Steffen Prohaska <hidden>
Date: 2016-06-15 22:43:43

On Oct 21, 2007, at 8:52 AM, Shawn O. Pearce wrote:
Steffen Prohaska [off-list ref] wrote:
quoted
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

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

From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:43:43

Steffen Prohaska [off-list ref] wrote:
On Oct 21, 2007, at 8:52 AM, Shawn O. Pearce wrote:
quoted
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.

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

From: Steffen Prohaska <hidden>
Date: 2016-06-15 22:43:44

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?

	Steffen

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

From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:43:44

Steffen Prohaska [off-list ref] wrote:
On Oct 21, 2007, at 8:47 AM, Steffen Prohaska wrote:
quoted
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 <redacted>
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 <redacted>
---
 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.

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

From: Peter Karlsson <hidden>
Date: 2016-06-15 22:43:44

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/

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

From: Alex Riesen <hidden>
Date: 2016-06-15 22:43:44

Peter Karlsson, Fri, Oct 26, 2007 10:00:32 +0200:
Steffen Prohaska:
quoted
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"

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

From: Peter Karlsson <hidden>
Date: 2016-06-15 22:43:45

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/

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

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:43:45

Hi,

On Mon, 29 Oct 2007, Peter Karlsson wrote:
Alex Riesen:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help