[med-svn] r631 - in trunk/community/website: . inc

hanska-guest at alioth.debian.org hanska-guest at alioth.debian.org
Sat Oct 6 08:36:16 UTC 2007


Author: hanska-guest
Date: 2007-10-06 08:36:16 +0000 (Sat, 06 Oct 2007)
New Revision: 631

Modified:
   trunk/community/website/inc/po-stats.inc.php
   trunk/community/website/locales.php
Log:
Locales now work (the statistics, at least)


Modified: trunk/community/website/inc/po-stats.inc.php
===================================================================
--- trunk/community/website/inc/po-stats.inc.php	2007-10-05 22:55:31 UTC (rev 630)
+++ trunk/community/website/inc/po-stats.inc.php	2007-10-06 08:36:16 UTC (rev 631)
@@ -11,12 +11,11 @@
 		fclose($fp);
 	}
 
-	// I don't wanna go crazy with regexes now. Yes, they might be simpler though.
-	$regex = "/^\"Last-Translator: (\w+.*<.*@.*>)/m";
+	$regex = "/^[\t ]*\"Last-Translator: (\w+.*<.*@.*>)/m";
 	preg_match($regex, $data, $matches);
 	$author = $matches[1];
 	
-	$regex = "/^\"Language-Team: (\w+.*<.*@.*>)/m";
+	$regex = "/^[\t ]*\"Language-Team: (\w+.*<.*@.*>)/m";
 	preg_match($regex, $data, $matches);
 	$team = $matches[1];
 
@@ -37,7 +36,7 @@
 		$arr[$i] = explode("\n", $arr[$i]);
 
 		for ($k = 0; $k < count($arr[$i]); $k++) {
-			preg_match("/(\w+) \"/", $arr[$i][$k], $matches);
+			preg_match("/(\w+)[\t ]+\"/", $arr[$i][$k], $matches);
 		
 			if (($matches[1] != "msgid" && $matches[1] != "msgstr") || !$matches[1]) {
 				$regex = "/(\w+.*\"\")/";
@@ -92,7 +91,7 @@
 		$regex = "/(\w+).*\"(.*)\"/";
 	
 		sort($item);
-			
+		
 		preg_match($regex, $item[0], $matches);
 		if (!trim($matches[2])) {
 			// this is just a fallback

Modified: trunk/community/website/locales.php
===================================================================
--- trunk/community/website/locales.php	2007-10-05 22:55:31 UTC (rev 630)
+++ trunk/community/website/locales.php	2007-10-06 08:36:16 UTC (rev 631)
@@ -57,26 +57,29 @@
 				<?php
 					require_once("inc/po-stats.inc.php");
 					
-					$handle = opendir($locales_dir);
+//					$handle = opendir($locales_dir);
+					$handle = opendir("locale/");
 					$avail_locales = array();
 					while ($file = readdir($handle)) {
 						if ($file != "." && $file != ".." && $file != ".svn") {
 							// we get this $locales_dir from locale.inc.php
-							if (is_dir($locales_dir.$file)) {
-								$po = "$locales_dir/$file/LC_MESSAGES/messages.po";
+//							if (is_dir($locales_dir.$file)) {
+//								$po = "$locales_dir/$file/LC_MESSAGES/messages.po";
+							if (is_dir("locale/$file")) {
+								$po = "locale/$file/LC_MESSAGES/messages.po";
 								$avail_locales[$file] = makePOStats($po);
 							}
 						}
 					}
 					
-					foreach ($avail_locales as $lang) {
+					while (list($code, $lang) = each($avail_locales)) {
 						if ($lang["complete"] == "100") {
 							$lang["complete"] = "<strong>".$lang["complete"]."</strong>";
 						}
 				?>
 				<tr>
-					<td style="text-align: center"><strong><?=key($avail_locales)?></strong></td>
-					<td style="text-align: center"><?=$lang["complete"]?>%</td>
+					<td style="text-align: center"><strong><?=$code?></strong></td>
+					<td style="text-align: center"><?=round($lang["complete"], 2)?>%</td>
 					<td><?=htmlentities($lang["author"])?></td>
 					<td><?=htmlentities($lang["team"])?></td>
 				</tr>




More information about the debian-med-commit mailing list