diff options
author | Peter Karlsson <peterk> | 2002-07-19 21:09:21 +0000 |
---|---|---|
committer | Peter Karlsson <peterk> | 2002-07-19 21:09:21 +0000 |
commit | fd7524a03bedfada06b6562b9f3b4af413dae0c4 (patch) | |
tree | ad52da0b0164edb9be08f192bd5dca7039eb48ce /copypage.pl | |
parent | 2791e6410aee5f1e28bbee420e440156caaba3a7 (diff) |
Applied changes based on patch from Denis Barbier: Checks the language.conf
for the keyword "sync", and if that is found, does not copy the Makefile
over to the new directory, but instead creates a simple Makefile which just
includes the English version.
CVS version numbers
copypage.pl: 1.15 -> 1.16
Diffstat (limited to 'copypage.pl')
-rwxr-xr-x | copypage.pl | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/copypage.pl b/copypage.pl index f3b17a58ac2..5d497dac988 100755 --- a/copypage.pl +++ b/copypage.pl @@ -3,9 +3,11 @@ # This script copies the file named on the command line to the translation # named in language.conf, and adds the translation-check header to it. # It also will create the destination directory if necessary, and copy the -# Makefile from the source. +# Makefile from the source. If the second line of the language.conf file +# contains the word "sync", a simple Makefile which just includes the English +# version will be created instead. -# Originally written 2000-02-26 by peter karlsson <peterk@debian.org> +# Originally written 2000-02-26 by Peter Karlsson <peterk@debian.org> # © Copyright 2000-2002 Software in the public interest, Inc. # This program is released under the GNU General Public License, v2. @@ -14,19 +16,25 @@ use File::Path; # Get configuration +$copymakefile = 1; if (exists $ENV{DWWW_LANG}) { $language = $ENV{DWWW_LANG}; } elsif (open CONF, "<language.conf") { - $language = <CONF>; - chomp $language; - close CONF; + while (<CONF>) + { + next if /^#/; + chomp; + $language = $_, next unless defined $language; + $copymakefile = 1 if $_ eq 'copy'; + $copymakefile = 0 if $_ eq 'sync'; + } } else { - $language = 'swedish'; + die "Language not defined in DWW_LANG or language.conf\n"; } # Check usage. @@ -36,7 +44,7 @@ if ($#ARGV == -1) print "Copies the page from the english/ directory to the $language/ directory\n"; print "and adds the translation-check header with the current revision.\n"; print "If the directory does not exist, it will be created, and the Makefile\n"; - print "copied.\n\n"; + print "copied or created, depending on your language.conf setting.\n\n"; print "You can either keep or not keep the 'english/' part of the path.\n"; exit; } @@ -99,9 +107,21 @@ sub copy mkpath([$dstdir],0,0755) or die "Could not create $dstdir: $!\n"; - if ( -e $srcmake ) { - print "creating and copying $dstmake\n"; - system "cp $srcmake $dstmake"; + if ( -e $srcmake ) + { + if ($copymakefile) + { + print "creating it and copying $srcmake\n"; + system "cp $srcmake $dstmake"; + } + else + { + print "creating it and making a $dstmake\n"; + open MK, "> $dstmake" + or die "Could not create $dstmake: $!\n"; + print MK "include \$(subst webwml/$language,webwml/english,\$(CURDIR))/Makefile\n"; + close MK; + } } } |