From dcd0d14d6a5939f9d3b3bcd6d65f643f1bdd1ebc Mon Sep 17 00:00:00 2001 From: Peter Karlsson Date: Thu, 12 Feb 2004 06:58:10 +0000 Subject: Applied patch from Luca Monducci : Allow setting the translation maintainer name from language.conf or the environment. CVS version numbers copypage.pl: 1.25 -> 1.26 --- copypage.pl | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) (limited to 'copypage.pl') diff --git a/copypage.pl b/copypage.pl index d25a73bf82c..824ff30f965 100755 --- a/copypage.pl +++ b/copypage.pl @@ -7,7 +7,7 @@ # Makefiles are not supported anymore for they bear too much space for errors. # Originally written 2000-02-26 by Peter Karlsson -# © Copyright 2000-2003 Software in the public interest, Inc. +# © Copyright 2000-2004 Software in the public interest, Inc. # This program is released under the GNU General Public License, v2. # $Id$ @@ -22,30 +22,47 @@ use vars qw(@iso_8859_2_compat @iso_8859_3_compat @iso_8859_4_compat @iso_8859_16_compat); # Get configuration -if (exists $ENV{DWWW_LANG}) -{ - $language = $ENV{DWWW_LANG}; -} -elsif (open CONF, ") { next if /^#/; chomp; $language = $_, next unless defined $language; + $maintainer = $_, next unless defined $maintainer; } + close CONF; } else { - die "Language not defined in DWWW_LANG or language.conf\n"; + warn "Unable to open language.conf. Using environment variables...\n"; } +# Values are overwritten by environment variables +if (exists $ENV{DWWW_LANG}) +{ + $language = $ENV{DWWW_LANG}; +} +if (exists $ENV{DWWW_MAINT}) +{ + $maintainer = $ENV{DWWW_MAINT}; +} + +die "Language not defined in DWWW_LANG or language.conf\n" + if not defined $language; + +#warn "Maintainer name not defined in DWWW_MAINT or language.conf\n" +# if not defined $maintainer; + + # Check usage. if ($#ARGV == -1) { print "Usage: $0 page ...\n\n"; 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 "and adds the translation-check header with the current revision,\n"; + print "optionally adds also the maintainer name.\n"; print "If the directory does not exist, it will be created, and the Makefile\n"; print "copied or created, depending on your language.conf setting.\n\n"; print "The 'english/' part of the input path is optional.\n"; @@ -240,7 +257,10 @@ sub copy unless ($insertedrevision || /^#/) { - print DST qq'#use wml::debian::translation-check translation="$revision"\n'; + print DST qq'#use wml::debian::translation-check translation="$revision"'; + print DST qq' maintainer="$maintainer"' + if defined $maintainer; + print DST qq'\n'; $insertedrevision = 1; } if (defined $pagetitle && /^/) @@ -279,7 +299,10 @@ sub copy unless ($insertedrevision) { - print DST qq'#use wml::debian::translation-check translation="$revision"\n'; + print DST qq'#use wml::debian::translation-check translation="$revision"'; + print DST qq' maintainer="$maintainer"' + if defined $maintainer; + print DST qq'\n'; } close SRC; -- cgit v1.2.3