[Po4a-commits] "po-debconf podebconf-report-po,1.56,1.57"
Nicolas FRANCOIS
nekral-guest at alioth.debian.org
Fri May 9 23:59:17 UTC 2008
Update of /cvsroot/po4a/po-debconf
In directory alioth:/tmp/cvs-serv32757
Modified Files:
podebconf-report-po
Log Message:
* Automatically detect if a debconf or non-debconf template should be used.
The --notdebconf option is still useful when the user wants to send a call
for the debconf translations and for the program translation from the
package's root directory.
Index: podebconf-report-po
===================================================================
RCS file: /cvsroot/po4a/po-debconf/podebconf-report-po,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- podebconf-report-po 9 May 2008 21:58:42 -0000 1.56
+++ podebconf-report-po 9 May 2008 23:59:13 -0000 1.57
@@ -41,6 +41,7 @@
use MIME::QuotedPrint;
use Getopt::Long;
use POSIX;
+use Cwd 'abs_path';
## Global variables
my $CONF_ARG;
@@ -99,15 +100,6 @@
my $SUBJECT_TRANSLATOR;
my $SUBJECT_SUBMIT;
my $SUBJECT_CALL;
-if ($NOT_DEBCONF) {
- $SUBJECT_TRANSLATOR = "<package_and_version>: Please update the PO translation for the package <package>";
- $SUBJECT_SUBMIT = "PO translations for the package <package> are outdated";
- $SUBJECT_CALL = "<package_and_version>: Please translate the package <package>";
-} else {
- $SUBJECT_TRANSLATOR = "<package_and_version>: Please update debconf PO translation for the package <package>";
- $SUBJECT_SUBMIT = "debconf PO translations for the package <package> are outdated";
- $SUBJECT_CALL = "<package_and_version>: Please translate debconf PO for the package <package>";
-}
my $SUBJECT = '';
my $BODY = '';
@@ -173,6 +165,50 @@
die "In the --call mode, the --languageteam option is only valid if --withtranslators is specified.\n";
}
+## Try to locate the PO directory
+if ($PODIR_ARG eq "") {
+ my $dir = getcwd;
+
+ if ($NOT_DEBCONF) {
+ if ($dir =~ m/\/po$/) {
+ $PODIR = ".";
+ } elsif (-d "$dir/po") {
+ $PODIR = "po";
+ }
+ } else {
+ if ($dir =~ m/\/po$/) {
+ $PODIR = ".";
+ } elsif (-d "$dir/debian/po") {
+ $PODIR = "debian/po";
+ } elsif (-d "$dir/po") {
+ $PODIR = "po";
+ }
+ }
+} else {
+ $PODIR = $PODIR_ARG;
+}
+die "Directory po not found, exiting!\n" if $PODIR eq "";
+die "Wrong argument: $PODIR is not a directory!\n" unless -d $PODIR;
+
+## Try to detect if it is a debconf template translation
+unless ($NOT_DEBCONF) {
+ my $dir = abs_path($PODIR);
+ if ($dir =~ m/\/po$/ and $dir !~ m/\/debian\/po$/) {
+ $NOT_DEBCONF = 1;
+ }
+}
+
+## Define the default subjects (if not set in the template)
+if ($NOT_DEBCONF) {
+ $SUBJECT_TRANSLATOR = "<package_and_version>: Please update the PO translation for the package <package>";
+ $SUBJECT_SUBMIT = "PO translations for the package <package> are outdated";
+ $SUBJECT_CALL = "<package_and_version>: Please translate the package <package>";
+} else {
+ $SUBJECT_TRANSLATOR = "<package_and_version>: Please update debconf PO translation for the package <package>";
+ $SUBJECT_SUBMIT = "debconf PO translations for the package <package> are outdated";
+ $SUBJECT_CALL = "<package_and_version>: Please translate debconf PO for the package <package>";
+}
+
my $conf = "";
unless ($NO_CONF or !defined $CONF_ARG) {
@@ -400,23 +436,6 @@
$EDITOR = $ENV{'EDITOR'} if exists($ENV{'EDITOR'});
$EDITOR = $ENV{'VISUAL'} if exists($ENV{'VISUAL'});
-## Try to locate the PO directory
-if ($PODIR_ARG eq "") {
- if ($NOT_DEBCONF) {
- foreach my $d (qw{.. .}) {
- $PODIR = "$d/po" if (-d "$d/po");
- }
- } else {
- foreach my $d (@TOPDIRS) {
- $PODIR = "$d/debian/po" if (-d "$d/debian/po");
- }
- }
-} else {
- $PODIR = $PODIR_ARG;
-}
-die "Directory po not found, exiting!\n" if $PODIR eq "";
-die "Wrong argument: $PODIR is not a directory!\n" unless -d $PODIR;
-
if ($no_zlib && $GZIP_ARG) {
$warn .=
"Warning: This program requires the libcompress-zlib-perl package in order\n".
More information about the Po4a-commits
mailing list