diff options
author | Peter Karlsson <peterk> | 2004-02-12 06:58:10 +0000 |
---|---|---|
committer | Peter Karlsson <peterk> | 2004-02-12 06:58:10 +0000 |
commit | dcd0d14d6a5939f9d3b3bcd6d65f643f1bdd1ebc (patch) | |
tree | e145a4e5fa0263a39e708843aa26dd3f5baf6f95 /copypage.pl | |
parent | 4866c985d285ac973780160454f320f0d773ac54 (diff) |
Applied patch from Luca Monducci <luca.mo@tiscali.it>:
Allow setting the translation maintainer name from language.conf or the
environment.
CVS version numbers
copypage.pl: 1.25 -> 1.26
Diffstat (limited to 'copypage.pl')
-rwxr-xr-x | copypage.pl | 43 |
1 files changed, 33 insertions, 10 deletions
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 <peterk@debian.org> -# © 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, "<language.conf") +# Read first two valid lines from language.conf +if (open CONF, "<language.conf") { while (<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 && /^<define-tag 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; |