2
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
2
eval 'exec perl -S $0 ${1+"$@"}'
3
3
if $running_under_some_shell;
5
5
# po4a -- Update both the po files and translated documents in one shoot
6
# $Id: po4a,v 1.82 2008-06-01 16:16:33 nekral-guest Exp $
6
# $Id: po4a,v 1.86 2009-03-07 12:33:10 nekral-guest Exp $
8
8
# Copyright 2002, 2003, 2004 by Martin Quinson (mquinson#debian.fr)
95
95
[po4a_paths] doc/$master/$master.pot $lang:doc/$master/$lang.po
97
=head2 Autodetection of the paths and languages
99
Another command can be used to specify the name of a directory where the
100
PO and POT files are located.
101
When it is used, po4a will detect the POT file as the only "*.pot" file
102
from the specified directory.
103
Po4a will also use the list of "*.po" files to define the list of
104
languages (by stripping out the extension).
105
These languages will be used for the substitution of the $lang variable in
106
the rest of the configuration file.
108
This command should not be used together with the po4a_langs or po4a_paths
111
[po_directory] po4a/po/
97
113
=head2 Specifying the documents to translate
99
115
You now naturally have to specify which documents are translated, their
641
657
@langs = split(/ /,$main." ".$args);
659
} elsif ($cmd eq "po_directory") {
660
die wrap_ref_mod("$config_file:$nb", "",
661
gettext("The list of languages cannot be set twice."))
663
die wrap_ref_mod("$config_file:$nb", "",
664
gettext("The POT file cannot be set twice."))
665
if length $pot_filename;
667
my $po_directory = $main;
668
die wrap_ref_mod("$config_file:$nb", "",
669
gettext("'%s' is not a directory"), $po_directory)
670
unless (-d $po_directory);
671
opendir PO_DIR, $po_directory
672
or die wrap_ref_mod("$config_file:$nb", "",
673
gettext("Cannot list the '%s' directory"), $po_directory);
675
foreach my $f (readdir PO_DIR) {
676
next unless -f "$po_directory/$f";
677
if ($f =~ m/^(.*)\.po$/) {
679
$po_filename{$1} = "$po_directory/$f";
681
if ($f =~ m/\.pot$/) {
682
if (length $pot_filename) {
683
die wrap_ref_mod("$config_file:$nb", "",
684
gettext("too many POT files: %s %s"),
685
$pot_filename, "$po_directory/$f");
687
$pot_filename = "$po_directory/$f";
693
warn wrap_ref_mod("$config_file:$nb", "",
694
gettext("no PO files found in %s"), $po_directory);
643
697
} elsif ($cmd =~ m/type: *(.*)/) {
644
698
if (defined $document{$main}{'format'}) {
645
699
warn wrap_ref_mod("$config_file:$nb", "",
715
769
$o =~ s/.*?\[options\] +//;
770
if (defined $document{''}{"options"}) {
771
%options = %{$document{''}{"options"}};
716
773
parse_config_options("$config_file:$nb",
718
$document{''}{"options"});
776
%{$document{''}{"options"}} = %options;
720
778
die wrap_ref_mod("$config_file:$nb", "",
721
779
gettext("Unparsable command '%s'."), $cmd);
731
789
my $options = shift;
790
my $options_orig = $options;
733
792
$options =~ s/\\"/"/g;
734
793
while (length $options) {
736
795
while (length $options and $options !~ /^ /s) {
796
if ( ($options =~ m/^(["'])/)
797
and ($options !~ m/^(["'])(?:\\.|(?!\1)[^\\])*\1/)) {
798
die wrap_msg(gettext("Cannot parse option line (missing >%s<?): %s"), $1, $options_orig);
737
800
# Extract non quoted parts
738
801
$options =~ s/^([^\\"' ]*)//s;
739
802
$o .= $1 if defined $1;