git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix translation of strings in foreach lists.
  2007-07-23 21:10 [PATCH] Mark many more strings for i18n Brett Schwarz
@ 2007-07-24  9:27 ` Christian Stimming
  2007-07-24 15:01   ` Shawn O. Pearce
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Stimming @ 2007-07-24  9:27 UTC (permalink / raw)
  To: Brett Schwarz, git, Paul Mackerras, Shawn O. Pearce,
	Junio C Hamano

Fix translation of strings in foreach lists.

Signed-off-by: Christian Stimming <stimming@tuhh.de>
---
Quoting Brett Schwarz <brett_schwarz@yahoo.com>:
> I not sure if it's worth changing, but you don't necessarily need   
> those [append]'s in there.

Thanks for the info. It is basically up to Shawn to decide which style  
he likes more.

This patch is already necessary because I accidentally messed up the  
foreach argument lists. With this patch those will work again and will  
additionally be translated as well. (Unfortunately, I can't commit to  
git-gui-i18n ATM due to a http-only-firewall connection. Johannes...?  
Thanks.)

  lib/database.tcl |   16 ++++++++--------
  lib/option.tcl   |   26 +++++++++++++-------------
  2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/lib/database.tcl b/lib/database.tcl
index 8dda9af..118b1b2 100644
--- a/lib/database.tcl
+++ b/lib/database.tcl
@@ -40,16 +40,16 @@ proc do_stats {} {

  	frame $w.stat -borderwidth 1 -relief solid
  	foreach s {
-		{count           [mc "Number of loose objects"]}
-		{size            [mc "Disk space used by loose objects"] { KiB}}
-		{in-pack         [mc "Number of packed objects"]}
-		{packs           [mc "Number of packs"]}
-		{size-pack       [mc "Disk space used by packed objects"] { KiB}}
-		{prune-packable  [mc "Packed objects waiting for pruning"]}
-		{garbage         [mc "Garbage files"]}
+		{count           {mc "Number of loose objects"}}
+		{size            {mc "Disk space used by loose objects"} { KiB}}
+		{in-pack         {mc "Number of packed objects"}}
+		{packs           {mc "Number of packs"}}
+		{size-pack       {mc "Disk space used by packed objects"} { KiB}}
+		{prune-packable  {mc "Packed objects waiting for pruning"}}
+		{garbage         {mc "Garbage files"}}
  		} {
  		set name [lindex $s 0]
-		set label [lindex $s 1]
+		set label [eval [lindex $s 1]]
  		if {[catch {set value $stats($name)}]} continue
  		if {[llength $s] > 2} {
  			set value "$value[lindex $s 2]"
diff --git a/lib/option.tcl b/lib/option.tcl
index 6c4d7ae..8d9e09d 100644
--- a/lib/option.tcl
+++ b/lib/option.tcl
@@ -183,22 +183,22 @@ proc do_options {} {

  	set optid 0
  	foreach option {
-		{t user.name [mc "User Name"]}
-		{t user.email [mc "Email Address"]}
-
-		{b merge.summary [mc "Summarize Merge Commits"]}
-		{i-1..5 merge.verbosity [mc "Merge Verbosity"]}
-		{b merge.diffstat [mc "Show Diffstat After Merge"]}
-
-		{b gui.trustmtime  [mc "Trust File Modification Timestamps"]}
-		{b gui.pruneduringfetch [mc "Prune Tracking Branches During Fetch"]}
-		{b gui.matchtrackingbranch [mc "Match Tracking Branches"]}
-		{i-0..99 gui.diffcontext [mc "Number of Diff Context Lines"]}
-		{t gui.newbranchtemplate [mc "New Branch Name Template"]}
+		{t user.name {mc "User Name"}}
+		{t user.email {mc "Email Address"}}
+
+		{b merge.summary {mc "Summarize Merge Commits"}}
+		{i-1..5 merge.verbosity {mc "Merge Verbosity"}}
+		{b merge.diffstat {mc "Show Diffstat After Merge"}}
+
+		{b gui.trustmtime  {mc "Trust File Modification Timestamps"}}
+		{b gui.pruneduringfetch {mc "Prune Tracking Branches During Fetch"}}
+		{b gui.matchtrackingbranch {mc "Match Tracking Branches"}}
+		{i-0..99 gui.diffcontext {mc "Number of Diff Context Lines"}}
+		{t gui.newbranchtemplate {mc "New Branch Name Template"}}
  		} {
  		set type [lindex $option 0]
  		set name [lindex $option 1]
-		set text [lindex $option 2]
+		set text [eval [lindex $option 2]]
  		incr optid
  		foreach f {repo global} {
  			switch -glob -- $type {
-- 
1.5.3.rc2.12.gbc280

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

* Re: [PATCH] Fix translation of strings in foreach lists.
  2007-07-24  9:27 ` [PATCH] Fix translation of strings in foreach lists Christian Stimming
@ 2007-07-24 15:01   ` Shawn O. Pearce
  2007-07-24 15:20     ` Christian Stimming
  0 siblings, 1 reply; 4+ messages in thread
From: Shawn O. Pearce @ 2007-07-24 15:01 UTC (permalink / raw)
  To: Christian Stimming; +Cc: Brett Schwarz, git, Paul Mackerras, Junio C Hamano

Christian Stimming <stimming@tuhh.de> wrote:
> Fix translation of strings in foreach lists.
> 
> Signed-off-by: Christian Stimming <stimming@tuhh.de>
> ---
> Quoting Brett Schwarz <brett_schwarz@yahoo.com>:
> >I not sure if it's worth changing, but you don't necessarily need   
> >those [append]'s in there.
> 
> Thanks for the info. It is basically up to Shawn to decide which style  
> he likes more.

"[mc Foo]\n\n$err"

is much shorter.  So I'd prefer that over [append [mc Foo] "\n\n$err"].
Its not like you've saved a dq-eval either, as you still have to do one
for the \n\n.  But either way is valid Tcl, and works, and the append
version is not so bad that I'd reject a patch that used it.
 
-- 
Shawn.

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

* Re: [PATCH] Fix translation of strings in foreach lists.
  2007-07-24 15:01   ` Shawn O. Pearce
@ 2007-07-24 15:20     ` Christian Stimming
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Stimming @ 2007-07-24 15:20 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Brett Schwarz, git, Paul Mackerras, Junio C Hamano

Quoting "Shawn O. Pearce" <spearce@spearce.org>:
>> >I not sure if it's worth changing, but you don't necessarily need
>> >those [append]'s in there.
>>
>> Thanks for the info. It is basically up to Shawn to decide which style
>> he likes more.
>
> "[mc Foo]\n\n$err"
>
> is much shorter.  So I'd prefer that over [append [mc Foo] "\n\n$err"].

Err, but the usual case is that the argument to [mc] is more than one  
word, and (additionally) that argument has to be quoted by  
double-quotes (as opposed to braces) because otherwise xgettext  
doesn't extract the message correctly. Hence, the only possibility  
here were

   "[mc "Some Text"]\n\n$err"

Is this valid Tcl? Being a newcomer to this language I have to says  
the quotes here look rather strange :-)

> Its not like you've saved a dq-eval either, as you still have to do one
> for the \n\n.  But either way is valid Tcl, and works, and the append
> version is not so bad that I'd reject a patch that used it.

Ok, thanks.

Christian

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

* Re: [PATCH] Fix translation of strings in foreach lists.
@ 2007-07-24 17:54 Brett Schwarz
  0 siblings, 0 replies; 4+ messages in thread
From: Brett Schwarz @ 2007-07-24 17:54 UTC (permalink / raw)
  To: Christian Stimming, Shawn O. Pearce; +Cc: git, Paul Mackerras, Junio C Hamano



> ----- Original Message ----
> From: Christian Stimming <stimming@tuhh.de>
> To: Shawn O. Pearce <spearce@spearce.org>
> Cc: Brett Schwarz <brett_schwarz@yahoo.com>; git@vger.kernel.org; Paul Mackerras <paulus@samba.org>; Junio C Hamano <gitster@pobox.com>
> Sent: Tuesday, July 24, 2007 8:20:28 AM
> Subject: Re: [PATCH] Fix translation of strings in foreach lists.
> 
> Quoting "Shawn O. Pearce" <spearce@spearce.org>:
> >> >I not sure if it's worth changing, but you don't necessarily need
> >> >those [append]'s in there.
> >>
> >> Thanks for the info. It is basically up to Shawn to decide which style
> >> he likes more.
> >
> > "[mc Foo]\n\n$err"
> >
> > is much shorter.  So I'd prefer that over [append [mc Foo] "\n\n$err"].
> 
> Err, but the usual case is that the argument to [mc] is more than one  
> word, and (additionally) that argument has to be quoted by  
> double-quotes (as opposed to braces) because otherwise xgettext  
> doesn't extract the message correctly. Hence, the only possibility  
> here were
> 
>    "[mc "Some Text"]\n\n$err"
> 
> Is this valid Tcl? Being a newcomer to this language I have to says  
> the quotes here look rather strange :-)
> 

Yes, that's valid.

bschwarz@bschwarz-desktop:~/gittcl$ tclsh
% package require msgcat
1.3.4
% namespace import msgcat::mc
% set err "ERROR"
ERROR
% msgcat::mcset en "hello there" HOWDY
HOWDY
% puts "[mc "hello there"]\n\n$err"
HOWDY

ERROR
%


HTH,
    --brett




       
____________________________________________________________________________________
Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
http://farechase.yahoo.com/

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

end of thread, other threads:[~2007-07-24 17:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-24 17:54 [PATCH] Fix translation of strings in foreach lists Brett Schwarz
  -- strict thread matches above, loose matches on Subject: below --
2007-07-23 21:10 [PATCH] Mark many more strings for i18n Brett Schwarz
2007-07-24  9:27 ` [PATCH] Fix translation of strings in foreach lists Christian Stimming
2007-07-24 15:01   ` Shawn O. Pearce
2007-07-24 15:20     ` Christian Stimming

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).