Git development
 help / color / mirror / Atom feed
* Re: git-gui-i18n: Make "Revert changes in these $n files" translatable.
@ 2007-07-26  8:47 Christian Stimming
       [not found] ` <20070726115301.GA27821@cc.hut.fi>
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Stimming @ 2007-07-26  8:47 UTC (permalink / raw)
  To: Harri Ilari Tapio Liusvaara
  Cc: Shawn O. Pearce, Brett Schwarz, git, Paul Mackerras,
	Junio C Hamano

Dear Harri, (responding to the commit in the mob branch)

thanks for discovering this message that was missed from translation.  
I'd like to use the opportunity to explain shortly the situation with  
plural form translations. You wrote:

+	# Split question between singular and plural cases, because
+	# such distinction is needed in some languages.

The issue with plural forms is even more complicated than that. In  
fact, the gettext library in C has the separate function ngettext()  
solely for the purpose of dealing with plural forms correctly; see  
http://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html#Plural-forms for the (lengthy but interesting) explanation. All one has to know is this: There are many languages out there that have not only one singular and one plural form, but much more of them, depending on the actual number of items being talked about. (Example: Three forms, with special cases for 1 and 2, 3, 4, in Slovak and  
Czech)

Unfortunately the msgcat package of Tcl is missing all support for a  
meaningful implementation of plural forms. (IMHO that's quite a  
shortcoming of msgcat and quite a big advantage of gettext, but there  
isn't an easy solution in sight. Whatever.) For that reason we have to  
refrain from using any plural-form-depending messages at all.

Enough of this discussion.

In this *particular* commit, the plural-form discussion misses the  
point with the message in question. In this particular message, if  
$n==1 (one single file to be reverted), the *file name* should be  
printed in the message. If $n > 1, the *number of files* should be  
printed in the message. The i18n error that had to be fixed is that  
the English message used to be built up from several parts, which is a  
no-no for translatable strings, and you have fixed that correctly.

Nevertheless the last [mc...] message in your commit doesn't end up  
that nicely for the translator. As you have the first sentence already  
in another language and translated separately, I would suggest to have  
the second sentence translated separately as well, and then appending  
these together in the actual message being shown. Like the patch below.

Thanks again for spotting this error.

Christian


diff --git a/lib/index.tcl b/lib/index.tcl
index 9080ac6..e1bda52 100644
--- a/lib/index.tcl
+++ b/lib/index.tcl
@@ -350,17 +350,15 @@ proc revert_helper {txt paths} {
                 unlock_index
                 return
         } elseif {$n == 1} {
-               set s "[short_path [lindex $pathList]]"
+               set query [mc "Revert changes in file %s?" [short_path  
[lindex $pathList]]]
         } else {
-               set s "these $n files"
+               set query [mc "Revert changes in these %i files?" $n]
         }

         set reply [tk_dialog \
                 .confirm_revert \
                 "[appname] ([reponame])" \
-               [mc "Revert changes in %s?
-
-Any unadded changes will be permanently lost by the revert." $s] \
+               "$query\n\n[mc "Any unadded changes will be  
permanently lost by the revert."]" \
                 question \
                 1 \
                 [mc "Do Nothing"] \
--
1.5.3.rc2.12.gbc280

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: git-gui-i18n: Make "Revert changes in these $n files" translatable.
       [not found] ` <20070726115301.GA27821@cc.hut.fi>
@ 2007-07-26 12:34   ` Christian Stimming
       [not found]     ` <20070726142152.GA5335@cc.hut.fi>
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Stimming @ 2007-07-26 12:34 UTC (permalink / raw)
  To: Harri Ilari Tapio Liusvaara
  Cc: Shawn O. Pearce, Brett Schwarz, git, Paul Mackerras,
	Junio C Hamano

Quoting Harri Ilari Tapio Liusvaara <hliusvaa@cc.hut.fi>:
> On Thu, Jul 26, 2007 at 10:47:23AM +0200, Christian Stimming wrote:
>> The issue with plural forms is even more complicated than that.
>
> Yes, I know that some languages have very complex plural forms. I even
> tought about that, but forgot to tack in FIXME comment. :-(

Ok. Thanks for adding the explanation.

> One can do bit nasty workarounds for the msgcat's inability to do
> proper plural form translation.

I don't think any workarounds for the plural forms would bring us very  
far. For now, I think it is just fine to state there is no plural form  
support in msgcat, so we can't use it. (That being said, I think the  
approach taken by gettext is by far the best one: Let the translator  
define the available plural forms inside the po file header by  
"Plural-Forms:". One would have to transfer this information over to  
tcl and add the necessary instrumentation into msgcat to process this  
expression. Maybe some day, some time.)

> BTW: Here is list of some missed translations:
>
> - Git version query when it can't grok the version (the yes/no one).
> - 3 Menu entries in "Repository" menu ("Browse branch files", "Browse
>   foo's files", "Visualize foo's history".

Thanks for all of them. I think now I caught them all. See patch  
below, which I'll push but not before the weekend (due to firewall  
restrictions).

> - Font setting names in options window.

You mean the names of the fonts? But those are names. I thought by  
definition they cannot be translated.

> - "Starting revision" in branch create window.
> - "Revision" in branch checkout window.

Thanks, fixed.

> - Buttons in hard reset confirmation (branch->revert or merge->abort,
>   and it is yes/no dialog).

I see this in translated form (German Ja/Nein), and also the button  
text (translated or not) doesn't appear in the git-gui source code.  
Maybe those need to be translated in the tcl/tk system libraries?

> - "Fetch from foo" entries in fetch menu.

Done. Thanks a lot.

---
  git-gui.sh              |   16 ++++++++--------
  lib/branch_checkout.tcl |    2 +-
  lib/branch_create.tcl   |    2 +-
  lib/browser.tcl         |    2 +-
  lib/checkout_op.tcl     |    2 +-
  lib/option.tcl          |    3 +--
  lib/remote.tcl          |    2 +-
  7 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/git-gui.sh b/git-gui.sh
index 3536d38..9f903ba 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -564,14 +564,14 @@ if {![regexp {^[1-9]+(\.[0-9]+)+$} $_git_version]} {
  		-type yesno \
  		-default no \
  		-title "[appname]: warning" \
-		-message "Git version cannot be determined.
+		 -message [mc "Git version cannot be determined.

-$_git claims it is version '$_real_git_version'.
+%s claims it is version '%s'.

-[appname] requires at least Git 1.5.0 or later.
+%s requires at least Git 1.5.0 or later.

-Assume '$_real_git_version' is version 1.5.0?
-"] eq {yes}} {
+Assume '%s' is version 1.5.0?
+" $_git $_real_git_version [appname] $_real_git_version]] eq {yes}} {
  		set _git_version 1.5.0
  	} else {
  		exit 1
@@ -1689,16 +1689,16 @@ menu .mbar.repository
  .mbar.repository add command \
  	-label [mc "Browse Current Branch's Files"] \
  	-command {browser::new $current_branch}
-trace add variable current_branch write ".mbar.repository entryconf  
[.mbar.repository index last] -label \"Browse \$current_branch's  
Files\" ;#"
+trace add variable current_branch write ".mbar.repository entryconf  
[.mbar.repository index last] -label \[format \"[mc "Browse %s's  
Files"]\" \$current_branch\] ;#"
  .mbar.repository add command \
-	-label {Browse Branch Files...} \
+	-label [mc "Browse Branch Files..."] \
  	-command browser_open::dialog
  .mbar.repository add separator

  .mbar.repository add command \
  	-label [mc "Visualize Current Branch's History"] \
  	-command {do_gitk $current_branch}
-trace add variable current_branch write ".mbar.repository entryconf  
[.mbar.repository index last] -label \"Visualize \$current_branch's  
History\" ;#"
+trace add variable current_branch write ".mbar.repository entryconf  
[.mbar.repository index last] -label \[format \"[mc "Visualize %s's  
History"]\" \$current_branch\] ;#"
  .mbar.repository add command \
  	-label [mc "Visualize All Branch History"] \
  	-command {do_gitk --all}
diff --git a/lib/branch_checkout.tcl b/lib/branch_checkout.tcl
index c727437..7d71821 100644
--- a/lib/branch_checkout.tcl
+++ b/lib/branch_checkout.tcl
@@ -29,7 +29,7 @@ constructor dialog {} {
  	pack $w.buttons.cancel -side right -padx 5
  	pack $w.buttons -side bottom -fill x -pady 10 -padx 10

-	set w_rev [::choose_rev::new $w.rev {Revision}]
+	set w_rev [::choose_rev::new $w.rev [mc Revision]]
  	$w_rev bind_listbox <Double-Button-1> [cb _checkout]
  	pack $w.rev -anchor nw -fill both -expand 1 -pady 5 -padx 5

diff --git a/lib/branch_create.tcl b/lib/branch_create.tcl
index acfe411..53dfb4c 100644
--- a/lib/branch_create.tcl
+++ b/lib/branch_create.tcl
@@ -63,7 +63,7 @@ constructor dialog {} {
  	grid columnconfigure $w.desc 1 -weight 1
  	pack $w.desc -anchor nw -fill x -pady 5 -padx 5

-	set w_rev [::choose_rev::new $w.rev {Starting Revision}]
+	set w_rev [::choose_rev::new $w.rev [mc "Starting Revision"]]
  	pack $w.rev -anchor nw -fill both -expand 1 -pady 5 -padx 5

  	labelframe $w.options -text [mc Options]
diff --git a/lib/browser.tcl b/lib/browser.tcl
index 9435e67..f9cfc6a 100644
--- a/lib/browser.tcl
+++ b/lib/browser.tcl
@@ -271,7 +271,7 @@ constructor dialog {} {
  	pack $w.buttons.cancel -side right -padx 5
  	pack $w.buttons -side bottom -fill x -pady 10 -padx 10

-	set w_rev [::choose_rev::new $w.rev {Revision}]
+	set w_rev [::choose_rev::new $w.rev [mc Revision]]
  	$w_rev bind_listbox <Double-Button-1> [cb _open]
  	pack $w.rev -anchor nw -fill both -expand 1 -pady 5 -padx 5

diff --git a/lib/checkout_op.tcl b/lib/checkout_op.tcl
index 25bf9cf..d2fbc30 100644
--- a/lib/checkout_op.tcl
+++ b/lib/checkout_op.tcl
@@ -76,7 +76,7 @@ method run {} {
  		_toplevel $this {Refreshing Tracking Branch}
  		set w_cons [::console::embed \
  			$w.console \
-			"Fetching $r_name from $remote"]
+			[mc "Fetching %s from %s" $r_name $remote]]
  		pack $w.console -fill both -expand 1
  		$w_cons exec $cmd [cb _finish_fetch]

diff --git a/lib/option.tcl b/lib/option.tcl
index 8d9e09d..20f1e8e 100644
--- a/lib/option.tcl
+++ b/lib/option.tcl
@@ -74,8 +74,7 @@ proc do_about {} {
  	pack $w.buttons -side bottom -fill x -pady 10 -padx 10

  	label $w.desc \
-		-text [append [mc "git-gui - a graphical user interface for Git."] "
-$copyright"] \
+		-text "[mc "git-gui - a graphical user interface for Git."]\n$copyright" \
  		-padx 5 -pady 5 \
  		-justify left \
  		-anchor w \
diff --git a/lib/remote.tcl b/lib/remote.tcl
index c47ae50..71c7a0d 100644
--- a/lib/remote.tcl
+++ b/lib/remote.tcl
@@ -153,7 +153,7 @@ proc populate_fetch_menu {} {
  		if {$enable} {
  			lappend prune_list $r
  			$m add command \
-				-label "Fetch from $r..." \
+				-label [mc "Fetch from %s..." $r] \
  				-command [list fetch_from $r]
  		}
  	}
-- 
1.5.3.rc2.12.gbc280

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: git-gui-i18n: Make "Revert changes in these $n files" translatable.
       [not found]     ` <20070726142152.GA5335@cc.hut.fi>
@ 2007-07-26 14:53       ` Christian Stimming
  0 siblings, 0 replies; 5+ messages in thread
From: Christian Stimming @ 2007-07-26 14:53 UTC (permalink / raw)
  To: Harri Ilari Tapio Liusvaara; +Cc: git, Paul Mackerras, Shawn O. Pearce

Quoting Harri Ilari Tapio Liusvaara <hliusvaa@cc.hut.fi>:
>> >BTW: Here is list of some missed translations:
>>
>> >- Font setting names in options window.
>>
>> You mean the names of the fonts? But those are names. I thought by
>> definition they cannot be translated.
>
> Nope. The texts are "Main Font:" and "Diff/Console Font:". They are
> specified in somewhat bizarre manner (Search for "Main Font") from
> git-gui.sh.

Ok, thanks for the pointer. Patch attached (will be push on the weekend).

>> >- Buttons in hard reset confirmation (branch->revert or merge->abort,
>> >  and it is yes/no dialog).
>>
>> I see this in translated form (German Ja/Nein), and also the button
>> text (translated or not) doesn't appear in the git-gui source code.
>> Maybe those need to be translated in the tcl/tk system libraries?
>
> I think that they might come from system libraries. But I'd rather
> use better labels. AFAIK, HCI guidelines say that yes/no dialogs
> are to be avoided, especally for confirming potentially destructive
> actions.

True for now. This would concern basically all question dialogs that  
appear in git-gui.

Christian


---
  git-gui.sh     |    4 ++--
  lib/option.tcl |    2 +-
  2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/git-gui.sh b/git-gui.sh
index 9f903ba..463ec32 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1652,8 +1652,8 @@ set default_config(gui.newbranchtemplate) {}
  set default_config(gui.fontui) [font configure font_ui]
  set default_config(gui.fontdiff) [font configure font_diff]
  set font_descs {
-	{fontui   font_ui   {Main Font}}
-	{fontdiff font_diff {Diff/Console Font}}
+	{fontui   font_ui   {mc "Main Font"}}
+	{fontdiff font_diff {mc "Diff/Console Font"}}
  }
  load_config 0
  apply_config
diff --git a/lib/option.tcl b/lib/option.tcl
index 20f1e8e..31c7d47 100644
--- a/lib/option.tcl
+++ b/lib/option.tcl
@@ -245,7 +245,7 @@ proc do_options {} {
  	foreach option $font_descs {
  		set name [lindex $option 0]
  		set font [lindex $option 1]
-		set text [lindex $option 2]
+		set text [eval [lindex $option 2]]

  		set global_config_new(gui.$font^^family) \
  			[font configure $font -family]
-- 
1.5.3.rc2.12.gbc280

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: git-gui-i18n: Make "Revert changes in these $n files" translatable.
@ 2007-07-27  6:41 Brett Schwarz
  2007-07-27 11:49 ` Christian Stimming
  0 siblings, 1 reply; 5+ messages in thread
From: Brett Schwarz @ 2007-07-27  6:41 UTC (permalink / raw)
  To: Christian Stimming, Harri Ilari Tapio Liusvaara
  Cc: Shawn O. Pearce, git, Paul Mackerras, Junio C Hamano

> 
> 
> ----- Original Message ----
> From: Christian Stimming <stimming@tuhh.de>
> To: Harri Ilari Tapio Liusvaara <hliusvaa@cc.hut.fi>
> Cc: Shawn O. Pearce <spearce@spearce.org>; Brett Schwarz <brett_schwarz@yahoo.com>; git@vger.kernel.org; Paul Mackerras <paulus@samba.org>; Junio C Hamano <gitster@pobox.com>
> Sent: Thursday, July 26, 2007 5:34:49 AM
> Subject: Re: git-gui-i18n: Make "Revert changes in these $n files" translatable.
> 
> Quoting Harri Ilari Tapio Liusvaara <hliusvaa@cc.hut.fi>:
> > On Thu, Jul 26, 2007 at 10:47:23AM +0200, Christian Stimming wrote:
> >> The issue with plural forms is even more complicated than that.
> >


<snip>

> > - Buttons in hard reset confirmation (branch->revert or merge->abort,
> >   and it is yes/no dialog).
> 
> I see this in translated form (German Ja/Nein), and also the button  
> text (translated or not) doesn't appear in the git-gui source code.  
> Maybe those need to be translated in the tcl/tk system libraries?
> 

These are indeed in the Tk libs. Unfortunately, there is no straight forward way to change the button text for tk_messageBox. I'll probably submit a patch to Tcl core for this.

In the mean time, if this is important, there are 2 ways around this:

1) override the button text in the msgcat. Tk does it's own msgcat internally (under the Tk namespace), and that's what prevents msgcat from changing these. You can see these under msgs directory where Tk is installed (/usr/local/tk8.4/msgs on my system). So, you would have to override for each language specified in that directory (if it warrants overriding). So, somewhere in the git-gui, you would have to do something like:
    namespace eval ::Tk {
      ::msgcat::mcset en_us &OK <new_term>
      ::msgcat::mcset en_us &Cancel <new_term>
      ::msgcat::mcset en_us &Yes <new_term>
      ::msgcat::mcset en_us &No <new_term>
      <continue for each language, if needed>
    }

2) Re-write the tk_messageBox, to include an option to specify the button text. This wouldn't be too hard actually, but this would live with git-gui.

I don't think option #1 is robust enough, but would be the easiest approach. Note also that this would only be for unix platforms, since for windows and Mac, it calls the platform's equivalent.

HTH,

    --brett






       
____________________________________________________________________________________
Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online.
http://smallbusiness.yahoo.com/webhosting 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: git-gui-i18n: Make "Revert changes in these $n files" translatable.
  2007-07-27  6:41 git-gui-i18n: Make "Revert changes in these $n files" translatable Brett Schwarz
@ 2007-07-27 11:49 ` Christian Stimming
  0 siblings, 0 replies; 5+ messages in thread
From: Christian Stimming @ 2007-07-27 11:49 UTC (permalink / raw)
  To: Brett Schwarz
  Cc: Harri Ilari Tapio Liusvaara, Shawn O. Pearce, git, Paul Mackerras,
	Junio C Hamano

Quoting Brett Schwarz <brett_schwarz@yahoo.com>:
>> > - Buttons in hard reset confirmation (branch->revert or merge->abort,
>> >   and it is yes/no dialog).
>>
>> Maybe those need to be translated in the tcl/tk system libraries?
>
> These are indeed in the Tk libs. Unfortunately, there is no straight  
>  forward way to change the button text for tk_messageBox. I'll   
> probably submit a patch to Tcl core for this.

That would indeed be a very good solution here.

> In the mean time, if this is important, there are 2 ways around this:
>
> 1) override the button text in the msgcat. (...)
> So, somewhere in the git-gui, you would  have to do something like:
>     namespace eval ::Tk {
>       ::msgcat::mcset en_us &OK <new_term>
>       ::msgcat::mcset en_us &Cancel <new_term>
>       ::msgcat::mcset en_us &Yes <new_term>
>       ::msgcat::mcset en_us &No <new_term>
>       <continue for each language, if needed>
>     }

I think this wouldn't help much here. First of all, the original  
messages might be different between different Tcl versions. But  
secondly and more importantly, as Harri Ilari pointed out, we should  
prefer to provide button texts different from Yes/No but rather  
questions like "Revert"/"Cancel".

> 2) Re-write the tk_messageBox, to include an option to specify the   
> button text. This wouldn't be too hard actually, but this would live  
>  with git-gui.

This would indeed be the nicer solution and it would improve both the  
English button labels and their translations all in one.

> I don't think option #1 is robust enough, but would be the easiest   
> approach. Note also that this would only be for unix platforms,   
> since for windows and Mac, it calls the platform's equivalent.

By the way: I have been using git-gui on Windows with mingw-git(+msys)  
and ActiveTcl for several weeks by now. Works like a charm, and I'm  
looking forward to propose it as a fully localized, fully  
cross-platform, and simply the best SCM, to the co-workers in my  
company... :-)

Christian

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-07-27 11:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-27  6:41 git-gui-i18n: Make "Revert changes in these $n files" translatable Brett Schwarz
2007-07-27 11:49 ` Christian Stimming
  -- strict thread matches above, loose matches on Subject: below --
2007-07-26  8:47 Christian Stimming
     [not found] ` <20070726115301.GA27821@cc.hut.fi>
2007-07-26 12:34   ` Christian Stimming
     [not found]     ` <20070726142152.GA5335@cc.hut.fi>
2007-07-26 14:53       ` Christian Stimming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox