From fd7524a03bedfada06b6562b9f3b4af413dae0c4 Mon Sep 17 00:00:00 2001 From: Peter Karlsson Date: Fri, 19 Jul 2002 21:09:21 +0000 Subject: 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 --- copypage.pl | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) (limited to 'copypage.pl') 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 +# Originally written 2000-02-26 by Peter Karlsson # © 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, "; - chomp $language; - close CONF; + while () + { + 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; + } } } -- cgit v1.2.3