[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/misc/translator tmpl_process3.pl,1.20,1.20.2.1
From: |
Ambrose C. LI |
Subject: |
[Koha-cvs] CVS: koha/misc/translator tmpl_process3.pl,1.20,1.20.2.1 |
Date: |
Sun, 23 Jan 2005 02:51:21 -0800 |
Update of /cvsroot/koha/koha/misc/translator
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6839
Modified Files:
Tag: rel_2_2
tmpl_process3.pl
Log Message:
Make the generated pot file (i.e., result of "create") look more "real",
but using msgmerge to reformat the output
Index: tmpl_process3.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/tmpl_process3.pl,v
retrieving revision 1.20
retrieving revision 1.20.2.1
diff -C2 -r1.20 -r1.20.2.1
*** tmpl_process3.pl 10 Mar 2004 07:00:28 -0000 1.20
--- tmpl_process3.pl 23 Jan 2005 10:51:16 -0000 1.20.2.1
***************
*** 263,276 ****
}
die "$str_file: Output file already exists\n" if -f $str_file;
! my($tmph, $tmpfile) = tmpnam();
# Generate the temporary file that acts as <MODULE>/POTFILES.in
for my $input (@in_files) {
! print $tmph "$input\n";
}
! close $tmph;
# Generate the specified po file ($str_file)
! $st = system ($xgettext, '-s', '-f', $tmpfile, '-o', $str_file);
! warn_normal "Text extraction failed: $xgettext: $!\n", undef if $st != 0;
! # unlink $tmpfile || warn_normal "$tmpfile: unlink failed: $!\n", undef;
} elsif ($action eq 'update') {
--- 263,301 ----
}
die "$str_file: Output file already exists\n" if -f $str_file;
! my($tmph1, $tmpfile1) = tmpnam();
! my($tmph2, $tmpfile2) = tmpnam();
! close $tmph2; # We just want a name
# Generate the temporary file that acts as <MODULE>/POTFILES.in
for my $input (@in_files) {
! print $tmph1 "$input\n";
}
! close $tmph1;
# Generate the specified po file ($str_file)
! $st = system ($xgettext, '-s', '-f', $tmpfile1, '-o', $tmpfile2);
! # Run msgmerge so that the pot file looks like a real pot file
! # We need to help msgmerge a bit by pre-creating a dummy po file that has
! # the headers and the "" msgid & msgstr. It will fill in the rest.
! if ($st == 0) {
! # Merge the temporary "pot file" with the specified po file ($str_file)
! # FIXME: msgmerge(1) is a Unix dependency
! # FIXME: need to check the return value
! unless (-f $str_file) {
! local(*INPUT, *OUTPUT);
! open(INPUT, "<$tmpfile2");
! open(OUTPUT, ">$str_file");
! while (<INPUT>) {
! print OUTPUT;
! last if /^\n/s;
! }
! close INPUT;
! close OUTPUT;
! }
! $st = system('msgmerge', '-U', '-s', $str_file, $tmpfile2);
! } else {
! error_normal "Text extraction failed: $xgettext: $!\n", undef;
! error_additional "Will not run msgmerge\n", undef;
! }
! # unlink $tmpfile1 || warn_normal "$tmpfile1: unlink failed: $!\n", undef;
! # unlink $tmpfile2 || warn_normal "$tmpfile2: unlink failed: $!\n", undef;
} elsif ($action eq 'update') {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/misc/translator tmpl_process3.pl,1.20,1.20.2.1,
Ambrose C. LI <=