#!/usr/bin/perl -w # vim: set sw=4 ts=4 si et: # Copyright: GPL, Written by: Guido Socher 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ý dillerde bulunduðu adresler:', 'Russian'=>'ÜÔÁ ÓÔÒÁÎÉÃÁ ÄÏÓÔÕÐÎÁ ÎÁ ÓÌÅÄÕÀÝÉÈ ÑÚÙËÁÈ:', 'Portugues'=>'Este artigo está disponível em:', 'Castellano'=>'Este documento está disponible en los siguientes idiomas:', 'Polish'=>'Ten dokument jest dostêpny w nastêpuj±cych jêzykach:' ); my ($k,$s,$availtxt,$file,$origlang); # if ($ENV{'DOCUMENT_URI'}){ print ""; # DOCUMENT_URI is somthing like: /English/July2001/article207.shtml my @pcomp=split(/\//,$ENV{'DOCUMENT_URI'}); exit 0 if ($#pcomp < 2); print "
"; 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 "".$k."  "; # take either shtml or html but not both: last; } } } } print "

\n"; }else{ print "\n"; } __END__