[GRASSweb-list]markus: web/devel i18n_stats.inc,1.7,1.8

grass at intevation.de grass at intevation.de
Thu Mar 17 11:50:16 EST 2005


Author: markus

Update of /grassrepository/web/devel
In directory doto:/tmp/cvs-serv1012

Modified Files:
	i18n_stats.inc 
Log Message:
Stephan Holl, www.GDF-Hannover.de: split of statistics table

Index: i18n_stats.inc
===================================================================
RCS file: /grassrepository/web/devel/i18n_stats.inc,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- i18n_stats.inc	12 Mar 2005 19:37:31 -0000	1.7
+++ i18n_stats.inc	17 Mar 2005 16:50:14 -0000	1.8
@@ -1,14 +1,60 @@
 <?php
 // i18n_stats.php - 2005 Stephan Holl, www.GDF-Hannover.de
 
-// Ausgabedatei erzeugen für den Cronjob (Pfad anpassen):
-$file = "../grass60/binary/linux/snapshot/i18n_stats.txt";
-$last_modified = filemtime($file);
+//------------------------------------------------------------------------
+// function zur Erstellung der tabellen
+function generate_table($file) {
+	
+	$last_modified = filemtime($file);
+	// einlesen der Datei
+	$array = file($file);
+	
+	?>
+	<P>
+	<table border="1" width="50%">
+	<tr>
+		<th>PO-Files</th><th>Translated<br>messages</th><th>Fuzzy<br>translations</th><th>Untranslated<br> messages</th>
+	</tr>	
+	<?php
+	$arr2 = array();
+	$arr3 = array();
+	$arr4 = array();
+	$arr5 = array();
+	foreach($array as $lines => $value) {
+		// array an Leerzeichen unterteilen
+		$split = explode(" ", $value);
+		// neues Array jeweils für die einzelnen Spalten schreiben
+		array_push($arr2, $split[0]);
+		array_push($arr3, $split[1]);
+		array_push($arr4, $split[4]);
+		array_push($arr5, $split[7]);
+	}
+	// Sortieren der Spalte 2 
+	arsort($arr3, SORT_ASC);
+	// ausgabe in tabelle basteln
+	foreach($arr3 as $names => $values) {
+		echo "<tr><td>" . $arr2[$names] . "</td>\n";
+		echo "<td align=\"center\" bgcolor=\"#c5e2ca\">" . $values . "</td>\n";
+		echo "<td align=\"center\">" . $arr4[$names] . "</td>\n";
+		echo "<td align=\"center\">" . $arr5[$names] . "</td></tr>\n";
+	}
+	?>
+	</table>
+	<br>
+	This table is generated weekly -
+	<?php
+	// Generate timestamp (use h:ia for a.m./p.m. )
+	print " -  last update: " . date("l, dS F, Y @ H:i.", $last_modified);
+} // End of function generate_table()
+//----------------------------------------------------------------
 
-// einlesen der Datei
-$array = file($file);
+// Ausgabedatei erzeugen für den Cronjob (Pfad anpassen):
+// $file = "../grass60/binary/linux/snapshot/i18n_stats.txt";
+// Präprocessing: cat i18n_stats.txt|grep mod > out.mods
+// Präprocessing: cat i18n_stats.txt|grep lib > out.libs
+$file_libs="../grass60/binary/linux/snapshot/out.libs";
+$file_mods="../grass60/binary/linux/snapshot/out.mods";
 
-// ausgabe in HTML-Tabelle
 ?>
 
 <hr>
@@ -18,44 +64,16 @@
 The table is ordered by number of translated messages per language.
 The two characters code indicating the language is based on Alpha-2 code of
 <a href="http://www.loc.gov/standards/iso639-2/englangn.html">ISO 639-1</a>.
-
-<P>
-<table border="1" width="50%">
-<tr>
-    <th>PO-Files</th><th>Translated<br>messages</th><th>Fuzzy<br>translations</th><th>Untranslated<br> messages</th>
-</tr>	
 <?php
-$arr2 = array();
-$arr3 = array();
-$arr4 = array();
-$arr5 = array();
-foreach($array as $lines => $value) {
-	// array an Leerzeichen unterteilen
-	$split = explode(" ", $value);
-	// neues Array jeweils für die einzelnen Spalten schreiben
-	array_push($arr2, $split[0]);
-	array_push($arr3, $split[1]);
-	array_push($arr4, $split[4]);
-	array_push($arr5, $split[7]);
-}
-// Sortieren der Spalte 2 
-arsort($arr3, SORT_ASC);
-// ausgabe in tabelle basteln
-foreach($arr3 as $names => $values) {
-	echo "<tr><td>" . $arr2[$names] . "</td>\n";
-	echo "<td align=\"center\" bgcolor=\"#c5e2ca\">" . $values . "</td>\n";
-	echo "<td align=\"center\">" . $arr4[$names] . "</td>\n";
-	echo "<td align=\"center\">" . $arr5[$names] . "</td></tr>\n";
-}
-?>
-</table>
-<br>
+// ausgabe in HTML-Tabelle durch Funktion generate_table()
+echo "<h2>GRASSLIBS</h2>\n";
+generate_table($file_libs);
+
+echo "<h2>GRASSMODS</h2>\n";
+generate_table($file_mods);
 
-This table is generated weekly -
-<?php
-// Generate timestamp (use h:ia for a.m./p.m. )
-print " -  last update: " . date("l, dS F, Y @ H:i.", $last_modified);
 ?>
+
 <br>
 The relevant column is 'Translated messages' as the message files
 do not necessarily contain all available messages of GRASS.





More information about the grass-web mailing list