[or-cvs] Add translation-status page

Peter Palfrader weasel at seul.org
Wed Oct 5 02:06:02 UTC 2005


Update of /home/or/cvsroot/website/include
In directory moria:/tmp/cvs-serv5614/include

Modified Files:
	functions.wmi head.wmi 
Log Message:
Add translation-status page

Index: functions.wmi
===================================================================
RCS file: /home/or/cvsroot/website/include/functions.wmi,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- functions.wmi	4 Oct 2005 23:18:44 -0000	1.3
+++ functions.wmi	5 Oct 2005 02:05:59 -0000	1.4
@@ -27,29 +27,35 @@
 	return %data;
 };
 
-sub translation_get_masterrevision() {
-	my $page = $WML_SRC_FILENAME;
-	%master = getMetadata("en/$WML_SRC_FILENAME");
+sub translation_get_masterrevision_file($) {
+	my ($page) = @_;
+	%master = getMetadata("en/$page");
 
-	die ("Cannot find 'Revision' header in master's translation metadata of en/$WML_SRC_FILENAME") unless exists $master{'Revision'};
+	die ("Cannot find 'Revision' header in master's translation metadata of en/$page") unless exists $master{'Revision'};
 
 	my ($rev) = $master{'Revision'} =~ m/([0-9.]+)/;
 	if ($rev eq '') { $rev = '(Revision not a valid number)'; };
 
 	return $rev;
 };
+sub translation_get_masterrevision() {
+	translation_get_masterrevision_file($WML_SRC_FILENAME);
+};
 
-sub translation_get_basedonrevision() {
-	my $page = $WML_SRC_FILENAME;
-	%translation = getMetadata("$(LANG)/$WML_SRC_FILENAME");
+sub translation_get_basedonrevision_langfile($$) {
+	my ($lang, $page) = @_;
+	%translation = getMetadata("$lang/$page");
 
-	die ("Cannot find 'Based-On-Revision' header in translations's translation metadata of $(LANG)/$WML_SRC_FILENAME") unless exists $translation{'Based-On-Revision'};
+	die ("Cannot find 'Based-On-Revision' header in translations's translation metadata of $lang/$page") unless exists $translation{'Based-On-Revision'};
 
 	my ($rev) = $translation{'Based-On-Revision'};
 	if ($rev eq '') { $rev = '(unknown)'; };
 
 	return $rev
 };
+sub translation_get_basedonrevision() {
+	translation_get_basedonrevision_langfile($(LANG), $WML_SRC_FILENAME);
+};
 
 
 sub translation_current() {

Index: head.wmi
===================================================================
RCS file: /home/or/cvsroot/website/include/head.wmi,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- head.wmi	4 Oct 2005 19:10:33 -0000	1.1
+++ head.wmi	5 Oct 2005 02:05:59 -0000	1.2
@@ -1,4 +1,5 @@
 #! /usr/bin/wml
+#include "perl-globals.wmi"
 #include "links.wmi"
 #include "versions.wmi"
 #include "navigation.wmi"
@@ -16,14 +17,6 @@
 
 <body>
 
-<:
-	%languages = (
-		'en' => "English",
-		'de' => "Deutsch",
-		'it' => "Italiano"
-		);
-:>
-
 <div class="center">
 <table class="banner" border="0" cellpadding="0" cellspacing="0">
     <tr>
@@ -50,14 +43,10 @@
         </td>
         <td class="banner-right">
 	<:
-	  opendir(DIR, ".") || die ("Cannot open directory .: $!\n");
-	  my @subdirs = grep { $_ ne '.' && $_ ne '..' && -d $_ && $_ ne "$(LANG)" && exists $languages{$_}} readdir(DIR);
-	  closedir(DIR);
-
 	  $page = $WML_SRC_FILENAME;
 	  $page =~ s/\.wml//;
-	  for my $dir (sort {$languages{$a} cmp $languages{$b}} @subdirs) {
-	    printf('<a href="%s.%s.html"><img src="$(IMGROOT)/%s.png" alt="%s" /></a>', $page, $dir, $dir, $languages{$dir}) if (-e "$dir/$WML_SRC_FILENAME");
+	  for my $dir (sort {$LANGUAGES{$a} cmp $LANGUAGES{$b}} @LANGUAGES) {
+	    printf('<a href="%s.%s.html"><img src="$(IMGROOT)/%s.png" alt="%s" /></a>', $page, $dir, $dir, $LANGUAGES{$dir}) if (-e "$dir/$WML_SRC_FILENAME");
 	  };
 	:>
         </td>



More information about the tor-commits mailing list