git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT-GUI PATCH 0/3] po2msg fixes
@ 2007-10-30 11:24 Johannes Schindelin
  2007-10-30 11:24 ` [GIT-GUI PATCH 1/3] po2msg: ignore entries marked with "fuzzy" Johannes Schindelin
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Johannes Schindelin @ 2007-10-30 11:24 UTC (permalink / raw)
  To: stimming, spearce, git

Hi,

this series of 3 patches fixes the following:

- fuzzy translations are ignored
- empty translations are ignored
- the --statistics option is implemented

Ciao,
Dscho

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

* [GIT-GUI PATCH 1/3] po2msg: ignore entries marked with "fuzzy"
  2007-10-30 11:24 [GIT-GUI PATCH 0/3] po2msg fixes Johannes Schindelin
@ 2007-10-30 11:24 ` Johannes Schindelin
  2007-10-30 11:24 ` [GIT-GUI PATCH 2/3] po2msg: ignore untranslated messages Johannes Schindelin
  2007-10-30 11:25 ` [GIT-GUI PATCH 3/3] po2msg: actually output statistics Johannes Schindelin
  2 siblings, 0 replies; 7+ messages in thread
From: Johannes Schindelin @ 2007-10-30 11:24 UTC (permalink / raw)
  To: stimming, spearce, git


As Christian Stimming pointed out, entries which are "fuzzy" need to
be checked by human translators, and cannot be used.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 po/po2msg.sh |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/po/po2msg.sh b/po/po2msg.sh
index da0765d..48a2669 100644
--- a/po/po2msg.sh
+++ b/po/po2msg.sh
@@ -48,12 +48,16 @@ for {set i 1} {$i < $argc} {incr i} {
 }
 
 proc flush_msg {} {
-	global msgid msgstr mode lang out
+	global msgid msgstr mode lang out fuzzy
 
 	if {![info exists msgid] || $mode == ""} {
 		return
 	}
 	set mode ""
+	if {$fuzzy == 1} {
+		set fuzzy 0
+		return
+	}
 
 	if {$msgid == ""} {
 		set prefix "set ::msgcat::header"
@@ -64,6 +68,7 @@ proc flush_msg {} {
 	puts $out "$prefix \"[u2a $msgstr]\""
 }
 
+set fuzzy 0
 foreach file $files {
 	regsub "^.*/\(\[^/\]*\)\.po$" $file "$output_directory\\1.msg" outfile
 	set in [open $file "r"]
@@ -73,7 +78,11 @@ foreach file $files {
 	set mode ""
 	while {[gets $in line] >= 0} {
 		if {[regexp "^#" $line]} {
-			flush_msg
+			if {[regexp ", fuzzy" $line]} {
+				set fuzzy 1
+			} else {
+				flush_msg
+			}
 			continue
 		} elseif {[regexp "^msgid \"(.*)\"$" $line dummy match]} {
 			flush_msg
-- 
1.5.3.4.1423.g7c7a7

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

* [GIT-GUI PATCH 2/3] po2msg: ignore untranslated messages
  2007-10-30 11:24 [GIT-GUI PATCH 0/3] po2msg fixes Johannes Schindelin
  2007-10-30 11:24 ` [GIT-GUI PATCH 1/3] po2msg: ignore entries marked with "fuzzy" Johannes Schindelin
@ 2007-10-30 11:24 ` Johannes Schindelin
  2007-10-30 19:27   ` Junio C Hamano
  2007-10-30 11:25 ` [GIT-GUI PATCH 3/3] po2msg: actually output statistics Johannes Schindelin
  2 siblings, 1 reply; 7+ messages in thread
From: Johannes Schindelin @ 2007-10-30 11:24 UTC (permalink / raw)
  To: stimming, spearce, git


Do not generate translations when the translated message is empty.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 po/po2msg.sh |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/po/po2msg.sh b/po/po2msg.sh
index 48a2669..91d420b 100644
--- a/po/po2msg.sh
+++ b/po/po2msg.sh
@@ -62,6 +62,9 @@ proc flush_msg {} {
 	if {$msgid == ""} {
 		set prefix "set ::msgcat::header"
 	} else {
+		if {$msgstr == ""} {
+			return
+		}
 		set prefix "::msgcat::mcset $lang \"[u2a $msgid]\""
 	}
 
-- 
1.5.3.4.1423.g7c7a7

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

* [GIT-GUI PATCH 3/3] po2msg: actually output statistics
  2007-10-30 11:24 [GIT-GUI PATCH 0/3] po2msg fixes Johannes Schindelin
  2007-10-30 11:24 ` [GIT-GUI PATCH 1/3] po2msg: ignore entries marked with "fuzzy" Johannes Schindelin
  2007-10-30 11:24 ` [GIT-GUI PATCH 2/3] po2msg: ignore untranslated messages Johannes Schindelin
@ 2007-10-30 11:25 ` Johannes Schindelin
  2 siblings, 0 replies; 7+ messages in thread
From: Johannes Schindelin @ 2007-10-30 11:25 UTC (permalink / raw)
  To: stimming, spearce, git


The "--statistics" option was ignored so far; no longer.  Now we have
a message similar to that of msgfmt.  (Untranslated, though ;-)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 po/po2msg.sh |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/po/po2msg.sh b/po/po2msg.sh
index 91d420b..78e49cc 100644
--- a/po/po2msg.sh
+++ b/po/po2msg.sh
@@ -26,11 +26,17 @@ proc u2a {s} {
 set output_directory "."
 set lang "dummy"
 set files [list]
+set show_statistics 0
 
 # parse options
-for {set i 1} {$i < $argc} {incr i} {
+for {set i 0} {$i < $argc} {incr i} {
 	set arg [lindex $argv $i]
-	if {$arg == "--statistics" || $arg == "--tcl"} {
+	if {$arg == "--statistics"} {
+		incr show_statistics
+		continue
+	}
+	if {$arg == "--tcl"} {
+		# we know
 		continue
 	}
 	if {$arg == "-l"} {
@@ -49,12 +55,14 @@ for {set i 1} {$i < $argc} {incr i} {
 
 proc flush_msg {} {
 	global msgid msgstr mode lang out fuzzy
+	global translated_count fuzzy_count not_translated_count
 
 	if {![info exists msgid] || $mode == ""} {
 		return
 	}
 	set mode ""
 	if {$fuzzy == 1} {
+		incr fuzzy_count
 		set fuzzy 0
 		return
 	}
@@ -63,15 +71,20 @@ proc flush_msg {} {
 		set prefix "set ::msgcat::header"
 	} else {
 		if {$msgstr == ""} {
+			incr not_translated_count
 			return
 		}
 		set prefix "::msgcat::mcset $lang \"[u2a $msgid]\""
+		incr translated_count
 	}
 
 	puts $out "$prefix \"[u2a $msgstr]\""
 }
 
 set fuzzy 0
+set translated_count 0
+set fuzzy_count 0
+set not_translated_count 0
 foreach file $files {
 	regsub "^.*/\(\[^/\]*\)\.po$" $file "$output_directory\\1.msg" outfile
 	set in [open $file "r"]
@@ -113,3 +126,9 @@ foreach file $files {
 	close $out
 }
 
+puts $show_statistics
+if {$show_statistics} {
+	puts [concat "$translated_count translated messages, " \
+		"$fuzzy_count fuzzy ones, " \
+		"$not_translated_count untranslated ones."]
+}
-- 
1.5.3.4.1423.g7c7a7

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

* Re: [GIT-GUI PATCH 2/3] po2msg: ignore untranslated messages
  2007-10-30 11:24 ` [GIT-GUI PATCH 2/3] po2msg: ignore untranslated messages Johannes Schindelin
@ 2007-10-30 19:27   ` Junio C Hamano
  2007-10-30 20:44     ` Christian Stimming
  2007-10-31  2:23     ` Johannes Schindelin
  0 siblings, 2 replies; 7+ messages in thread
From: Junio C Hamano @ 2007-10-30 19:27 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: stimming, spearce, git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Do not generate translations when the translated message is empty.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  po/po2msg.sh |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/po/po2msg.sh b/po/po2msg.sh
> index 48a2669..91d420b 100644
> --- a/po/po2msg.sh
> +++ b/po/po2msg.sh
> @@ -62,6 +62,9 @@ proc flush_msg {} {
>  	if {$msgid == ""} {
>  		set prefix "set ::msgcat::header"
>  	} else {
> +		if {$msgstr == ""} {
> +			return
> +		}
>  		set prefix "::msgcat::mcset $lang \"[u2a $msgid]\""
>  	}

Is this change to fix some real issues?

Sometimes it is handy to be able to translate a non-empty string
into an empty one in one target language.

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

* Re: [GIT-GUI PATCH 2/3] po2msg: ignore untranslated messages
  2007-10-30 19:27   ` Junio C Hamano
@ 2007-10-30 20:44     ` Christian Stimming
  2007-10-31  2:23     ` Johannes Schindelin
  1 sibling, 0 replies; 7+ messages in thread
From: Christian Stimming @ 2007-10-30 20:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Schindelin, spearce, git

Am Dienstag, 30. Oktober 2007 20:27 schrieb Junio C Hamano:
> > Do not generate translations when the translated message is empty.
> >
> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> > ---
> >  po/po2msg.sh |    3 +++
> >  1 files changed, 3 insertions(+), 0 deletions(-)
> >
> > diff --git a/po/po2msg.sh b/po/po2msg.sh
> > index 48a2669..91d420b 100644
> > --- a/po/po2msg.sh
> > +++ b/po/po2msg.sh
> > @@ -62,6 +62,9 @@ proc flush_msg {} {
> >  	if {$msgid == ""} {
> >  		set prefix "set ::msgcat::header"
> >  	} else {
> > +		if {$msgstr == ""} {
> > +			return
> > +		}
> >  		set prefix "::msgcat::mcset $lang \"[u2a $msgid]\""
> >  	}
>
> Is this change to fix some real issues?

I don't think to - it just makes the resulting foo.msg file smaller.

> Sometimes it is handy to be able to translate a non-empty string
> into an empty one in one target language.

Err... no, this is not the case. The semantics of an msgstr == "" is identical 
to saying "No translation exists to this source string".  Nothing more, 
nothing less. You can't specify a translation that should map a given string 
to an empty string. (If you make up a case when that would make some sense, 
usually the source string is rather weirdly chosen and should be reworded.)

Christian

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

* Re: [GIT-GUI PATCH 2/3] po2msg: ignore untranslated messages
  2007-10-30 19:27   ` Junio C Hamano
  2007-10-30 20:44     ` Christian Stimming
@ 2007-10-31  2:23     ` Johannes Schindelin
  1 sibling, 0 replies; 7+ messages in thread
From: Johannes Schindelin @ 2007-10-31  2:23 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: stimming, spearce, git

Hi,

On Tue, 30 Oct 2007, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > Do not generate translations when the translated message is empty.
> >
> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> > ---
> >  po/po2msg.sh |    3 +++
> >  1 files changed, 3 insertions(+), 0 deletions(-)
> >
> > diff --git a/po/po2msg.sh b/po/po2msg.sh
> > index 48a2669..91d420b 100644
> > --- a/po/po2msg.sh
> > +++ b/po/po2msg.sh
> > @@ -62,6 +62,9 @@ proc flush_msg {} {
> >  	if {$msgid == ""} {
> >  		set prefix "set ::msgcat::header"
> >  	} else {
> > +		if {$msgstr == ""} {
> > +			return
> > +		}
> >  		set prefix "::msgcat::mcset $lang \"[u2a $msgid]\""
> >  	}
> 
> Is this change to fix some real issues?

Yes.  I compared the output of po2msg.sh with that of msgfmt, and only 
with this change (and 1/3) they came up identical.

Ciao,
Dscho

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

end of thread, other threads:[~2007-10-31  2:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-30 11:24 [GIT-GUI PATCH 0/3] po2msg fixes Johannes Schindelin
2007-10-30 11:24 ` [GIT-GUI PATCH 1/3] po2msg: ignore entries marked with "fuzzy" Johannes Schindelin
2007-10-30 11:24 ` [GIT-GUI PATCH 2/3] po2msg: ignore untranslated messages Johannes Schindelin
2007-10-30 19:27   ` Junio C Hamano
2007-10-30 20:44     ` Christian Stimming
2007-10-31  2:23     ` Johannes Schindelin
2007-10-30 11:25 ` [GIT-GUI PATCH 3/3] po2msg: actually output statistics Johannes Schindelin

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