68 lines
2.6 KiB
Perl
68 lines
2.6 KiB
Perl
|
#!/usr/bin/perl -w
|
|||
|
# vim: set sw=4 ts=4 si et:
|
|||
|
# Copyright: GPL, Written by: Guido Socher <guido.socher at linuxfocus.org>
|
|||
|
my $ver="1.5";
|
|||
|
#
|
|||
|
# This program is executed from a serverside include to insert automatically
|
|||
|
# links to the different languages an articel is availabe in.
|
|||
|
# The link is inserted if the file exists in that language and the
|
|||
|
# size is bigger than 2Kb.
|
|||
|
#
|
|||
|
my @languages=('English','Castellano','ChineseGB','Deutsch',
|
|||
|
'Francais','Italiano','Nederlands','Portugues','Indonesian',
|
|||
|
'Russian','Turkce','Korean','Arabic','Polish','Serbian');
|
|||
|
#
|
|||
|
my %text=('Deutsch'=>'Dieses Dokument ist verfübar auf:',
|
|||
|
'Nederlands'=>'Dit document is beschikbaar in:',
|
|||
|
'English'=>'This document is available in:',
|
|||
|
'Francais'=>'Ce document est disponible en:',
|
|||
|
'Italiano'=>'Questo documento è disponibile in:',
|
|||
|
'Turkce'=>'Bu makalenin farkl<6B> dillerde bulundu<64>u adresler:',
|
|||
|
'Russian'=>'<27><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:',
|
|||
|
'Portugues'=>'Este artigo está disponível em:',
|
|||
|
'Castellano'=>'Este documento está disponible en los siguientes idiomas:',
|
|||
|
'Polish'=>'Ten dokument jest dost<73>pny w nast<73>puj<75>cych j<>zykach:'
|
|||
|
);
|
|||
|
my ($k,$s,$availtxt,$file,$origlang);
|
|||
|
#
|
|||
|
if ($ENV{'DOCUMENT_URI'}){
|
|||
|
print "<!-- addedByLfdynahead ver $ver -->";
|
|||
|
# DOCUMENT_URI is somthing like: /English/July2001/article207.shtml
|
|||
|
my @pcomp=split(/\//,$ENV{'DOCUMENT_URI'});
|
|||
|
exit 0 if ($#pcomp < 2);
|
|||
|
print "<TABLE ALIGN=\"right\" border=0><TR><TD ALIGN=\"right\"><FONT SIZE=\"-1\" FACE=\"Arial,Helvetica\">";
|
|||
|
my $month_and_sfile=$pcomp[$#pcomp-1] . "/" . $pcomp[$#pcomp];
|
|||
|
$origlang=$pcomp[$#pcomp-2];
|
|||
|
if ($text{$origlang}){
|
|||
|
$availtxt=$text{$origlang};
|
|||
|
}else{
|
|||
|
$availtxt=$text{'English'};
|
|||
|
}
|
|||
|
my $month_and_file=$month_and_sfile;
|
|||
|
$month_and_file=~s/\.shtml$/.html/;
|
|||
|
#
|
|||
|
$file="$origlang/$month_and_sfile";
|
|||
|
foreach $k (@languages){
|
|||
|
# test if the file exists and if it is larger than 2K
|
|||
|
foreach $file ("$k/$month_and_sfile", "$k/$month_and_file"){
|
|||
|
if ( -f "$file"){
|
|||
|
$s=(stat("$file"))[7];
|
|||
|
if ($s > 2100){
|
|||
|
if ($availtxt){
|
|||
|
print "$availtxt ";
|
|||
|
$availtxt=0;
|
|||
|
}
|
|||
|
print "<A href=\"../../$file\">".$k."</a> ";
|
|||
|
# take either shtml or html but not both:
|
|||
|
last;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
print "</FONT></TD></TR></TABLE><br>\n";
|
|||
|
}else{
|
|||
|
print "<!-- Lfdynahead error: DOCUMENT_URI not defined -->\n";
|
|||
|
}
|
|||
|
__END__
|
|||
|
|