[Po4a-commits] "po4a po4a,1.42,1.43"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Sat Nov 19 18:27:56 UTC 2005


Update of /cvsroot/po4a/po4a
In directory haydn:/tmp/cvs-serv424

Modified Files:
	po4a 
Log Message:
Adds the --rm-translations, --no-backups, --rm-backups options. They
should help the maintainers (who don't need the backup files, and need to
remove the translations in the 'make clean' rules).
Po4a is about easing the translation work. Not only for the translators.


Index: po4a
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- po4a	17 Nov 2005 23:33:13 -0000	1.42
+++ po4a	19 Nov 2005 18:27:53 -0000	1.43
@@ -226,6 +226,18 @@
 
 Do not generate the translated documents, only update the POT and PO files.
 
+=item --rm-translations
+
+Remove the translated files (implies --no-translations).
+
+=item --no-backups
+
+Do not generate the .po~ backup files.
+
+=item --rm-backups
+
+Remove the .po~ backup files (implies --no-backups).
+
 =back
 
 =head1 SHORTCOMINGS
@@ -309,6 +321,9 @@
         "quiet"           => 0,
         "split"           => 0,
         "no-translations" => 0,
+        "rm-translations" => 0,
+        "no-backups"      => 0,
+        "rm-backups"      => 0,
         "threshold"       => 80,
         "mastchar"        => "",
         "locchar"         => "",
@@ -330,6 +345,9 @@
         'split|s'               => \$opts{"split"},
         'keep|k=s'              => \$opts{"threshold"},
         'no-translations'       => \$opts{"no-translations"},
+        'rm-translations'       => \$opts{"rm-translations"},
+        'no-backups'            => \$opts{"no-backups"},
+        'rm-backups'            => \$opts{"rm-backups"},
         'version|V'             => \&show_version,
         'option|o=s'            => \@options
     ) or pod2usage();
@@ -350,6 +368,11 @@
             $opts{"options"}{$_}=1;
         }
     }
+
+    # The rm- options imply the no-
+    $opts{"no-translations"} = 1 if $opts{"rm-translations"};
+    $opts{"no-backups"} = 1 if $opts{"rm-backups"};
+
     return %opts;
 }
 
@@ -619,7 +642,7 @@
 
 		$pot->write($pot_filename);
 		$po->write($po_filename);
-		system ("msgmerge -U $po_filename $pot_filename")
+		system ("msgmerge -U $po_filename $pot_filename --backup=none")
 		    && die wrap_msg(gettext("Error while running msgmerge: %s"), $!);
 		$pores->read($po_filename);
 	    }
@@ -628,7 +651,9 @@
 	    unlink($po_filename) if -e $po_filename;
 
 	} else {
-	    system ("msgmerge -U ".$po_filename{$lang}." $pot_filename ".($po4a_opts{"verbose"}?"":">/dev/null 2>/dev/null"))
+	    system ("msgmerge -U ".$po_filename{$lang}." $pot_filename".
+	            ($po4a_opts{"no-backups"}?" --backup=none":"").
+	            ($po4a_opts{"verbose"}?"":" >/dev/null 2>/dev/null"))
 		&& die wrap_msg(gettext("Error while running msgmerge: %s"), $!);
 	    system "msgfmt --statistics -v -o /dev/null ".$po_filename{$lang} 
 	    if $po4a_opts{"verbose"};
@@ -641,6 +666,16 @@
     }
 }
 
+if ($po4a_opts{"rm-backups"}) {
+    # Delete the .po~ backup files generated by msgmerge
+
+    unless ($po4a_opts{"split"}) {
+	foreach $lang (sort keys %po_filename) {
+	    unlink $po_filename{$lang}."~";
+	}
+    }
+}
+
 if (not $po4a_opts{"no-translations"}) {
     # update all translations
 
@@ -709,5 +744,15 @@
 	}
     }
 }
+
+if ($po4a_opts{"rm-translations"}) {
+    # Delete the translated documents
+    foreach $lang (sort keys %po_filename) {
+	foreach my $master (sort keys %document) {
+	    unlink $document{$master}{$lang};
+	}
+    }
+}
+
   
 __END__




More information about the Po4a-commits mailing list