You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by jf...@apache.org on 2012/04/17 22:01:14 UTC

svn commit: r1327259 [3/7] - in /incubator/vcl/trunk/web: ./ .ht-inc/ js/ js/nls/ js/nls/ja_JP/ js/nls/zh_CN/ js/vcldojo/ js/vcldojo/nls/ js/vcldojo/nls/ja-jp/ js/vcldojo/nls/zh-cn/ locale/ locale/ja_JP/ locale/ja_JP/LC_MESSAGES/ locale/po_files/ local...

Modified: incubator/vcl/trunk/web/.ht-inc/states.php
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/states.php?rev=1327259&r1=1327258&r2=1327259&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/states.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/states.php Tue Apr 17 20:01:13 2012
@@ -35,12 +35,14 @@ $actions["entry"] = array('main',
                           'viewSchedules',
                           'selectComputers',
                           'selectMgmtnodeOption',
+                          'serverProfiles',
                           'pickTimeTable',
                           'viewNodes',
                           'userLookup',
+                          'editVMInfo',
+                          'siteMaintenance',
                           'selectstats',
                           'helpform',
-                          'viewdocs',
                           'logout',
                           'shiblogout',
                           'xmlrpccall',
@@ -51,12 +53,9 @@ $actions["entry"] = array('main',
                           'clearCache',
                           'errorrpt',
                           'auth',
-                          'editVMInfo',
                           'continuationsError',
                           'requestBlockAllocation',
-                          'siteMaintenance',
                           'dashboard',
-                          'serverProfiles',
 );
 
 $noHTMLwrappers = array('sendRDPfile',
@@ -182,6 +181,7 @@ $noHTMLwrappers = array('sendRDPfile',
                         'AJcanceltovmhostinuse',
                         'jsonUserGroupStore',
                         'jsonResourceGroupStore',
+                        'changeLocale',
 );
 
 # main
@@ -762,11 +762,13 @@ $actions['mode']['continuationsError'] =
 $actions['mode']['clearCache'] = "clearPrivCache";
 $actions['mode']['errorrpt'] = "errorrpt";
 $actions['mode']['AJvalidateUserid'] = "AJvalidateUserid";
+$actions['mode']['changeLocale'] = "changeLocale";
 $actions['pages']['continuationsError'] = "misc";
 $actions['pages']['clearCache'] = "misc";
 $actions['pages']['errorrpt'] = "misc";
 $actions['pages']['logout'] = "misc";
 $actions['pages']['shiblogout'] = "misc";
 $actions['pages']['AJvalidateUserid'] = "misc";
+$actions['pages']['changeLocale'] = "misc";
 
 ?>

Modified: incubator/vcl/trunk/web/.ht-inc/statistics.php
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/statistics.php?rev=1327259&r1=1327258&r2=1327259&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/statistics.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/statistics.php Tue Apr 17 20:01:13 2012
@@ -38,10 +38,10 @@ define("ORDERERR", 1 << 2);
 ////////////////////////////////////////////////////////////////////////////////
 function selectStatistics() {
 	global $submitErr, $user;
-	list($month1, $day1, $year1) = explode(',', date('F,j,Y', time() - 
+	list($month1, $day1, $year1) = explode(',', date('n,j,Y', time() - 
 	                                    (SECINDAY * 6)));
-	list($month2, $day2, $year2) = explode(',', date('F,j,Y', time()));
-	print "<H2>Statistic Information</H2>\n";
+	list($month2, $day2, $year2) = explode(',', date('n,j,Y', time()));
+	print _("<H2>Statistic Information</H2>\n");
 	if($submitErr) {
 		printSubmitErr(STARTERR);
 		printSubmitErr(ENDERR);
@@ -56,20 +56,10 @@ function selectStatistics() {
 	}
 	else
 		$affilid = $user['affiliationid'];
-	print "Select a starting date:<br>\n";
-	$months = array("",
-	                "January",
-	                "February",
-	                "March",
-	                "April",
-	                "May",
-	                "June",
-	                "July",
-	                "August",
-	                "September",
-	                "October",
-	                "November",
-	                "December");
+	print _("Select a starting date:<br>\n");
+	$months = array('');
+	for($i = 2 * SECINDAY, $cnt = 1; $cnt < 13; $i += SECINMONTH, $cnt++)
+		$months[$cnt] = strftime('%B', $i);
 	unset($months[0]);
 	$days = array();
 	for($i = 0; $i < 32; $i++) {
@@ -81,7 +71,7 @@ function selectStatistics() {
 		$years[$i] = $i;
 	}
 	if(! $submitErr) {
-		$monthkey1 = array_search($month1, $months);
+		$monthkey1 = $month1;
 		$daykey1 = array_search($day1, $days);
 		$yearkey1 = array_search($year1, $years);
 	}
@@ -90,9 +80,9 @@ function selectStatistics() {
 	printSelectInput("day1", $days, $daykey1);
 	printSelectInput("year1", $years, $yearkey1);
 	print "<br>\n";
-	print "Select a ending date:<br>\n";
+	print _("Select an ending date:<br>\n");
 	if(! $submitErr) {
-		$monthkey2 = array_search($month2, $months);
+		$monthkey2 = $month2;
 		$daykey2 = array_search($day2, $days);
 		$yearkey2 = array_search($year2, $years);
 	}
@@ -104,7 +94,7 @@ function selectStatistics() {
 	if(checkUserHasPerm('View Statistics by Affiliation')) {
 		print "<input type=radio id=stattype1 name=continuation value=\"$cont\" checked>\n";
 		print "<label for=stattype1>View General Statistics</label> - \n";
-		print "Select an affiliation:\n";
+		print _("Select an affiliation:\n");
 		$affils = getAffiliations();
 		if(! array_key_exists($affilid, $affils))
 			$affilid = $user['affiliationid'];
@@ -132,7 +122,7 @@ function selectStatistics() {
 	}
 	else
 		print "<INPUT type=hidden name=continuation value=\"$cont\">\n";
-	print "<INPUT type=submit value=Submit>\n";
+	print _("<INPUT type=submit value=Submit>\n");
 	print "</FORM>\n";
 }
 
@@ -183,19 +173,19 @@ function viewStatistics() {
 	$end = "$year2-$month2-$day2 23:59:59";
 	if(! checkdate($month1, $day1, $year1)) {
 		$submitErr |= STARTERR;
-		$submitErrMsg[STARTERR] = "The selected start date is not valid. Please "
-		                        . "select a valid date.<br>\n";
+		$submitErrMsg[STARTERR] = _("The selected start date is not valid. Please ")
+		                        . _("select a valid date.<br>\n");
 	}
 	if(! checkdate($month2, $day2, $year2)) {
 		$submitErr |= ENDERR;
-		$submitErrMsg[ENDERR] = "The selected end date is not valid. Please "
-		                      . "select a valid date.<br>\n";
+		$submitErrMsg[ENDERR] = _("The selected end date is not valid. Please ")
+		                      . _("select a valid date.<br>\n");
 	}
 	if(datetimeToUnix($start) > datetimeToUnix($end)) {
 		$submitErr |= ORDERERR;
-		$submitErrMsg[ORDERERR] = "The selected end date is before the selected "
-		                        . "start date.  Please select an end date equal "
-		                        . "to or greater than the start date.<br>\n";
+		$submitErrMsg[ORDERERR] = _("The selected end date is before the selected ")
+		                        . _("start date.  Please select an end date equal ")
+		                        . _("to or greater than the start date.<br>\n");
 	}
 	if($submitErr) {
 		selectStatistics();
@@ -204,12 +194,16 @@ function viewStatistics() {
 
 	$timestart = microtime(1);
 	if($mode2 == 'default')
-		print "<H2>Statistic Information for $statsfor</H2>\n";
+		print "<H2>" . _("Statistic Information for") . " $statsfor</H2>\n";
 	elseif($mode2 == 'provisioning')
-		print "<H2>Statistic Information for {$provs[$provid]}</H2>\n";
-	print "<H3>Reservation information between $month1/$day1/$year1 and ";
-	print "$month2/$day2/$year2:\n";
-	print "</H3>\n";
+		print "<H2>" . _("Statistic Information for") . " {$provs[$provid]}</H2>\n";
+	print _("<H3>Reservation information between ");
+	$tmp = mktime(0, 0, 0, $month1, $day1, $year1);
+	print strftime('%x', $tmp);
+	print _(" and ");
+	$tmp = mktime(0, 0, 0, $month2, $day2, $year2);
+	print strftime('%x', $tmp);
+	print ":</H3>\n";
 	$reloadid = getUserlistID('vclreload@local');
 	if($mode2 == 'default') {
 		$query = "SELECT l.userid, "
@@ -380,40 +374,40 @@ function viewStatistics() {
 	print "<DIV align=center>\n";
 	print "<TABLE>\n";
 	print "  <TR>\n";
-	print "    <TH align=right>Total Reservations:</TH>\n";
+	print _("    <TH align=right>Total Reservations:</TH>\n");
 	print "    <TD>$totalreservations</TD>\n";
 	print "  </TR>\n";
 	print "  <TR>\n";
-	print "    <TH align=right>Total Hours Used:</TH>\n";
+	print _("    <TH align=right>Total Hours Used:</TH>\n");
 	print "    <TD>" . (int)$totalhours . "</TD>\n";
 	print "  </TR>\n";
 	print "  <TR>\n";
-	print "    <TH align=right>\"Now\" Reservations:</TH>\n";
+	print _("    <TH align=right>\"Now\" Reservations:</TH>\n");
 	print "    <TD>$nows</TD>\n";
 	print "  </TR>\n";
 	print "  <TR>\n";
-	print "    <TH align=right>\"Later\" Reservations:</TH>\n";
+	print _("    <TH align=right>\"Later\" Reservations:</TH>\n");
 	print "    <TD>$futures</TD>\n";
 	print "  </TR>\n";
 	print "  <TR>\n";
-	print "    <TH align=right>Unavailable:</TH>\n";
+	print _("    <TH align=right>Unavailable:</TH>\n");
 	print "    <TD>$notavailable</TD>\n";
 	print "  </TR>\n";
 	print "  <TR>\n";
-	print "    <TH align=right>Load times &lt; 2 minutes:</TH>\n";
+	print _("    <TH align=right>Load times &lt; 2 minutes:</TH>\n");
 	print "    <TD>{$loadtimes['2less']}</TD>\n";
 	print "  </TR>\n";
 	print "  <TR>\n";
-	print "    <TH align=right>Load times &gt;= 2 minutes:</TH>\n";
+	print _("    <TH align=right>Load times &gt;= 2 minutes:</TH>\n");
 	print "    <TD>{$loadtimes['2more']}</TD>\n";
 	print "  </TR>\n";
 	print "  <TR>\n";
-	print "    <TH align=right>Total Unique Users:</TH>\n";
+	print _("    <TH align=right>Total Unique Users:</TH>\n");
 	print "    <TD>" . count($users) . "</TD>\n";
 	print "  </TR>\n";
 	foreach(array_keys($osusers) as $key) {
 		print "  <TR>\n";
-		print "    <TH align=right>Unique Users of $key:</TH>\n";
+		print _("    <TH align=right>Unique Users of ") . $key . _(":</TH>\n");
 		print "    <TD>" . count($osusers[$key]) . "</TD>\n";
 		print "  </TR>\n";
 	}
@@ -422,12 +416,12 @@ function viewStatistics() {
 	print "<TABLE>\n";
 	print "  <TR>\n";
 	print "    <TD></TD>\n";
-	print "    <TH>Reservations</TH>\n";
-	print "    <TH>Unique Users</TH>\n";
-	print "    <TH>Hours Used</TH>\n";
-	print "    <TH>&lt; 2 min load time</TH>\n";
-	print "    <TH>&gt;= 2 min load time</TH>\n";
-	print "    <TH>Failures</TH>\n";
+	print _("    <TH>Reservations</TH>\n");
+	print _("    <TH>Unique Users</TH>\n");
+	print _("    <TH>Hours Used</TH>\n");
+	print _("    <TH>&lt; 2 min load time</TH>\n");
+	print _("    <TH>&gt;= 2 min load time</TH>\n");
+	print _("    <TH>Failures</TH>\n");
 	print "  </TR>\n";
 	foreach($imagecount as $key => $value) {
 		print "  <TR>\n";
@@ -455,67 +449,67 @@ function viewStatistics() {
 	}
 	print "</TABLE>\n";
 
-	print "<H3>Durations:</H3>\n";
+	print _("<H3>Durations:</H3>\n");
 	print "<TABLE>\n";
 	print "  <TR>\n";
-	print "    <TH align=right>0 - 30 Min:</TH>\n";
+	print _("    <TH align=right>0 - 30 Min:</TH>\n");
 	print "    <TD>" . $lengths["30min"] . "</TD>\n";
 	print "  </TR>\n";
 	print "  <TR>\n";
-	print "    <TH align=right>30 Min - 1 Hour:</TH>\n";
+	print _("    <TH align=right>30 Min - 1 Hour:</TH>\n");
 	print "    <TD>" . $lengths["1hour"] . "</TD>\n";
 	print "  </TR>\n";
 	print "  <TR>\n";
-	print "    <TH align=right>1 Hour - 2 Hours:</TH>\n";
+	print _("    <TH align=right>1 Hour - 2 Hours:</TH>\n");
 	print "    <TD>" . $lengths["2hours"] . "</TD>\n";
 	print "  </TR>\n";
 	print "  <TR>\n";
-	print "    <TH align=right>2 Hours - 4 Hours:</TH>\n";
+	print _("    <TH align=right>2 Hours - 4 Hours:</TH>\n");
 	print "    <TD>" . $lengths["4hours"] . "</TD>\n";
 	print "  </TR>\n";
 	print "  <TR>\n";
-	print "    <TH align=right>&gt; 4 Hours:</TH>\n";
+	print _("    <TH align=right>&gt; 4 Hours:</TH>\n");
 	print "    <TD>" . $lengths["4hrsplus"] . "</TD>\n";
 	print "  </TR>\n";
 	print "</TABLE>\n";
 
-	print "<H3>Ending information:</H3>\n";
+	print _("<H3>Ending information:</H3>\n");
 	print "<TABLE>\n";
 	print "  <TR>\n";
-	print "    <TH align=right>Deleted:</TH>\n";
+	print _("    <TH align=right>Deleted:</TH>\n");
 	print "    <TD>" . $ending["deleted"] . "</TD>\n";
 	print "    <TD rowspan=7><img src=\"images/blank.gif\" width=5></TD>\n";
-	print "    <TD>(Future reservation deleted before start time reached)</TD>\n";
+	print _("    <TD>(Future reservation deleted before start time reached)</TD>\n");
 	print "  </TR>\n";
 	print "  <TR>\n";
-	print "    <TH align=right>Released:</TH>\n";
+	print _("    <TH align=right>Released:</TH>\n");
 	print "    <TD>" . $ending["released"] . "</TD>\n";
-	print "    <TD>(Reservation released before end time reached)</TD>\n";
+	print _("    <TD>(Reservation released before end time reached)</TD>\n");
 	print "  </TR>\n";
 	print "  <TR>\n";
-	print "    <TH align=right>Not Acknowledged:</TH>\n";
+	print _("    <TH align=right>Not Acknowledged:</TH>\n");
 	print "    <TD>" . $ending["noack"] . "</TD>\n";
-	print "    <TD>(\"Connect!\" button never clicked)</TD>\n";
+	print _("    <TD>(\"Connect!\" button never clicked)</TD>\n");
 	print "  </TR>\n";
 	print "  <TR>\n";
-	print "    <TH align=right>No Login:</TH>\n";
+	print _("    <TH align=right>No Login:</TH>\n");
 	print "    <TD>" . $ending["nologin"] . "</TD>\n";
-	print "    <TD>(User never logged in)</TD>\n";
+	print _("    <TD>(User never logged in)</TD>\n");
 	print "  </TR>\n";
 	print "  <TR>\n";
-	print "    <TH align=right>End of Reservation:</TH>\n";
+	print _("    <TH align=right>End of Reservation:</TH>\n");
 	print "    <TD>" . $ending["EOR"] . "</TD>\n";
-	print "    <TD>(End of reservation reached)</TD>\n";
+	print _("    <TD>(End of reservation reached)</TD>\n");
 	print "  </TR>\n";
 	print "  <TR>\n";
-	print "    <TH align=right>Timed Out:</TH>\n";
+	print _("    <TH align=right>Timed Out:</TH>\n");
 	print "    <TD>" . $ending["timeout"] . "</TD>\n";
-	print "    <TD>(Disconnect and no reconnection within 15 minutes)</TD>\n";
+	print _("    <TD>(Disconnect and no reconnection within 15 minutes)</TD>\n");
 	print "  </TR>\n";
 	print "  <TR>\n";
-	print "    <TH align=right>Failed:</TH>\n";
+	print _("    <TH align=right>Failed:</TH>\n");
 	print "    <TD>" . $ending["failed"] . "</TD>\n";
-	print "    <TD>(Reserved computer failed to get prepared for user)</TD>\n";
+	print _("    <TD>(Reserved computer failed to get prepared for user)</TD>\n");
 	print "  </TR>\n";
 	print "</TABLE>\n";
 	print "<br>\n";
@@ -530,33 +524,33 @@ function viewStatistics() {
 	               'affilid' => $affilid,
 	               'mode' => $mode2,
 	               'provid' => $provid);
-	print "<H2>Reservations by Day</H2>\n";
-	print "<small>(Reservations with start time on given day)</small><br>\n";
+	print _("<H2>Reservations by Day</H2>\n");
+	print "<small>" . _("(Reservations with start time on given day)") . "</small><br>\n";
 	$cdata['divid'] = 'resbyday';
 	$cont = addContinuationsEntry('AJgetStatData', $cdata);
 	print "<input type=hidden id=statdaycont value=\"$cont\">\n";
 	print "<div id=\"resbyday\" class=\"statgraph\">(Loading...)</div>\n";
 
-	print "<H2>Max Concurrent Reservations By Day</H2>\n";
+	print _("<H2>Max Concurrent Reservations By Day</H2>\n");
 	$cdata['divid'] = 'maxconcurresday';
 	$cont = addContinuationsEntry('AJgetStatData', $cdata);
 	print "<input type=hidden id=statconcurrescont value=\"$cont\">\n";
 	print "<div id=\"maxconcurresday\" class=\"statgraph\">Loading graph data...</div>\n";
 
-	print "<H2>Max Concurrent Blade Reservations By Day</H2>\n";
+	print _("<H2>Max Concurrent Blade Reservations By Day</H2>\n");
 	$cdata['divid'] = 'maxconcurbladeday';
 	$cont = addContinuationsEntry('AJgetStatData', $cdata);
 	print "<input type=hidden id=statconcurbladecont value=\"$cont\">\n";
 	print "<div id=\"maxconcurbladeday\" class=\"statgraph\">Loading graph data...</div>\n";
 
-	print "<H2>Max Concurrent Virtual Machine Reservations By Day</H2>\n";
+	print "<H2>" . _("Max Concurrent Virtual Machine Reservations By Day") . "</H2>\n";
 	$cdata['divid'] = 'maxconcurvmday';
 	$cont = addContinuationsEntry('AJgetStatData', $cdata);
 	print "<input type=hidden id=statconcurvmcont value=\"$cont\">\n";
 	print "<div id=\"maxconcurvmday\" class=\"statgraph\">Loading graph data...</div>\n";
 
-	print "<H2>Reservations by Hour</H2>\n";
-	print "<small>(Active reservations during given hour averaged over selected dates)</small><br><br>\n";
+	print _("<H2>Reservations by Hour</H2>\n");
+	print "<small>(" . _("Active reservations during given hour averaged over selected dates") . ")</small><br><br>\n";
 	$cdata['divid'] = 'resbyhour';
 	$cont = addContinuationsEntry('AJgetStatData', $cdata);
 	print "<input type=hidden id=statreshourcont value=\"$cont\">\n";
@@ -916,7 +910,7 @@ function getStatGraphDayConUsersData($st
 	while($row = mysql_fetch_assoc($qh))
 		$cachepts[$row['statdate']] = $row['value'];
 	if((count($cachepts) + 31) < $daycnt) {
-		$data = array('nodata' => '(too much computational time required to generate this graph)');
+		$data = array('nodata' => _('(too much computational time required to generate this graph)'));
 		return $data;
 	}
 	for($daystart = $startunix; $daystart < $endunix; $daystart += SECINDAY) {
@@ -1060,7 +1054,7 @@ function getStatGraphConBladeUserData($s
 	while($row = mysql_fetch_assoc($qh))
 		$cachepts[$row['statdate']] = $row['value'];
 	if((count($cachepts) + 31) < $daycnt) {
-		$data = array('nodata' => '(too much computational time required to generate this graph)');
+		$data = array('nodata' => _('(too much computational time required to generate this graph)'));
 		return $data;
 	}
 	for($daystart = $startunix; $daystart < $endunix; $daystart += SECINDAY) {
@@ -1238,7 +1232,7 @@ function getStatGraphConVMUserData($star
 	while($row = mysql_fetch_assoc($qh))
 		$cachepts[$row['statdate']] = $row['value'];
 	if((count($cachepts) + 31) < $daycnt) {
-		$data = array('nodata' => '(too much computational time required to generate this graph)');
+		$data = array('nodata' => _('(too much computational time required to generate this graph)'));
 		return $data;
 	}
 	for($daystart = $startunix; $daystart < $endunix; $daystart += SECINDAY) {

Modified: incubator/vcl/trunk/web/.ht-inc/userpreferences.php
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/userpreferences.php?rev=1327259&r1=1327258&r2=1327259&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/userpreferences.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/userpreferences.php Tue Apr 17 20:01:13 2012
@@ -50,10 +50,10 @@ function userpreferences() {
 			$data["resolution"] = $user["width"] . "x" . $user["height"];
 	}
 
-	print "<H2 align=center>User Preferences</H2>\n";
+	print _("<H2 align=center>User Preferences</H2>\n");
 	print "<div align=center id=status class=visible>\n";
 	if($mode == "submituserprefs") {
-		print "<font color=green>User preferences successfully updated</font><br>\n";
+		print _("<font color=green>User preferences successfully updated</font><br>\n");
 	}
 	print "</div>\n";
 	print "<table summary=\"\">\n";
@@ -66,14 +66,14 @@ function userpreferences() {
 	   $user['affiliation'] == 'Local') {
 		$showpersonal = 1;
 		print "      <li><a href=#personal onclick=\"";
-		print "show('personal'); return false;\">Personal&nbsp;Information</a>";
+		print _("show('personal'); return false;\">Personal&nbsp;Information</a>");
 		print "</li>\n";
 	}
 	print "      <li><a href=#rdpfile onclick=\"";
-	print "show('rdpfile'); return false;\">RDP&nbsp;File&nbsp;Preferences</a>";
+	print _("show('rdpfile'); return false;\">RDP&nbsp;File&nbsp;Preferences</a>");
 	print "</li>\n";
 	print "      <li><a href=#uiprefs onclick=\"javascript:show('uiprefs'); ";
-	print "return false\">General&nbsp;Preferences</a></li>\n";
+	print _("return false\">General&nbsp;Preferences</a></li>\n");
 	print "      </ul>\n";
 	print "      </div>\n";
 	print "    </TD>\n";
@@ -81,20 +81,20 @@ function userpreferences() {
 	print "    <TD rowspan=2>\n";
 	if($showpersonal) {
 		print "      <fieldset id=personal class=shown>\n";
-		print "      <legend>Personal</legend>\n";
+		print _("      <legend>Personal</legend>\n");
 		print "      <FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
 		print "      <table summary=\"displays your personal information\">\n";
 		$showsubmit = 0;
 		if(! empty($user['firstname'])) {
 			print "        <TR>\n";
-			print "          <TH align=right>First Name<a href=#updateinfo>*</a>:</TH>\n";
+			print _("          <TH align=right>First Name<a href=#updateinfo>*</a>:</TH>\n");
 			print "          <TD>" . $user["firstname"] . "</TD>\n";
 			print "          <TD></TD>\n";
 			print "        </TR>\n";
 		}
 		if(! empty($user['lastname'])) {
 			print "        <TR>\n";
-			print "          <TH align=right>Last Name<a href=#updateinfo>*</a>:</TH>\n";
+			print _("          <TH align=right>Last Name<a href=#updateinfo>*</a>:</TH>\n");
 			print "          <TD>" . $user["lastname"] . "</TD>\n";
 			print "          <TD></TD>\n";
 			print "        </TR>\n";
@@ -102,7 +102,7 @@ function userpreferences() {
 		# preferred name is stored locally; allow setting preferred name if a firstname is defined
 		if(! empty($user['firstname'])) {
 			print "        <TR>\n";
-			print "          <TH align=right>Preferred Name:</TH>\n";
+			print _("          <TH align=right>Preferred Name:</TH>\n");
 			print "          <TD><label class=hidden for=preferredname>Preferred Name</label>\n";
 			print "              <INPUT type=text name=preferredname maxlength=100 ";
 			print "size=15 value=\"" . $data["preferredname"] . "\"></TD>\n";
@@ -114,17 +114,17 @@ function userpreferences() {
 		}
 		if(! empty($user['email'])) {
 			print "        <TR>\n";
-			print "          <TH align=right>Email Address<a href=#updateinfo>*</a>:</TH>\n";
+			print _("          <TH align=right>Email Address<a href=#updateinfo>*</a>:</TH>\n");
 			print "          <TD>" . $user["email"] . "</TD>\n";
 			print "          <TD></TD>\n";
 			print "        </TR>\n";
 		}
 		if($user['affiliation'] == 'Local') {
 			print "        <TR>\n";
-			print "          <TD colspan=3 align=center><h3>Change Password</h3></TD>\n";
+			print _("          <TD colspan=3 align=center><h3>Change Password</h3></TD>\n");
 			print "        </TR>\n";
 			print "        <TR>\n";
-			print "          <TH align=right>Current Password:</TH>\n";
+			print _("          <TH align=right>Current Password:</TH>\n");
 			print "          <TD>\n";
 			print "            <label class=hidden for=currentpassword>Current Password</label>\n";
 			print "            <INPUT type=password name=currentpassword maxlength=100 size=15>\n";
@@ -134,7 +134,7 @@ function userpreferences() {
 			print "</TD>\n";
 			print "        </TR>\n";
 			print "        <TR>\n";
-			print "          <TH align=right>New Password:</TH>\n";
+			print _("          <TH align=right>New Password:</TH>\n");
 			print "          <TD>\n";
 			print "            <label class=hidden for=newpassword>New Password</label>\n";
 			print "            <INPUT type=password name=newpassword maxlength=100 ";
@@ -143,7 +143,7 @@ function userpreferences() {
 			print "          <TD></TD>\n";
 			print "        </TR>\n";
 			print "        <TR>\n";
-			print "          <TH align=right>Confirm Password:</TH>\n";
+			print _("          <TH align=right>Confirm Password:</TH>\n");
 			print "          <TD>\n";
 			print "            <label class=hidden for=confirmpassword>Confirm Password</label>\n";
 			print "            <INPUT type=password name=confirmpassword maxlength=100 ";
@@ -162,7 +162,7 @@ function userpreferences() {
 			$cont = addContinuationsEntry('confirmpersonalprefs', array(), SECINDAY, 1, 1, 1);
 			print "      <INPUT type=hidden name=continuation value=\"$cont\">\n";
 			print "      <div align=center>\n";
-			print "      <INPUT type=submit value=\"Submit Changes\">\n";
+			print _("      <INPUT type=submit value=\"Submit Changes\">\n");
 			print "      </div>\n";
 		}
 		print "      </FORM>\n";
@@ -170,18 +170,18 @@ function userpreferences() {
 	}
 
 	print "      <fieldset id=rdpfile class=shown>\n";
-	print "      <legend>RDP</legend>\n";
+	print _("      <legend>RDP</legend>\n");
 	print "      <FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
 	print "      <table summary=\"lists adjustable preferences for the RDP ";
 	print "file that is sent when you click the Get RDP File button on the ";
 	print "Connect! page\">\n";
 	print "        <TR>\n";
-	print "          <TD colspan=3><small>Try decreasing <em>Resolution</em> or <em>";
-	print "Color Depth</em> to<br>speed up your connection if things seem ";
-	print "slow<br>when connected to a remote computer.</small></TD>\n";
+	print _("          <TD colspan=3><small>Try decreasing <em>Resolution</em> or <em>");
+	print _("Color Depth</em> to<br>speed up your connection if things seem ");
+	print _("slow<br>when connected to a remote computer.</small></TD>\n");
 	print "        </TR>\n";
 	print "        <TR>\n";
-	print "          <TH align=right>Resolution:</TH>\n";
+	print _("          <TH align=right>Resolution:</TH>\n");
 	$resolutionArray = array("Full Screen" => "Full Screen",
 	                         "1920x1440" => "1920x1440",
 	                         "1600x1200" => "1600x1200",
@@ -202,7 +202,7 @@ function userpreferences() {
 	print "          <TD></TD>\n";
 	print "        </TR>\n";
 	print "        <TR>\n";
-	print "          <TH align=right>Color Depth:</TH>\n";
+	print _("          <TH align=right>Color Depth:</TH>\n");
 	print "          <TD>\n";
 	#$colordepth = array("8" => "8", "16" => "16", "24" => "24");
 	$colordepth = array("8" => "8", "16" => "16", "24" => "24", "32" => "32 (Vista only)");
@@ -211,30 +211,30 @@ function userpreferences() {
 	print "          <TD></TD>\n";
 	print "        </TR>\n";
 	print "        <TR>\n";
-	print "          <TH align=right>Audio:</TH>\n";
+	print _("          <TH align=right>Audio:</TH>\n");
 	print "          <TD>\n";
-	$audio = array("none" => "None", "local" => "Use my speakers");
+	$audio = array("none" => _("None"), "local" => _("Use my speakers"));
 	printSelectInput("audiomode", $audio, $data["audiomode"]);
 	print "          </TD>\n";
 	print "          <TD></TD>\n";
 	print "        </TR>\n";
 	print "        <TR>\n";
-	print "          <TH align=right>Map Local Drives:</TH>\n";
+	print _("          <TH align=right>Map Local Drives:</TH>\n");
 	print "          <TD>\n";
-	$yesno = array(1 => "Yes", 0 => "No");
+	$yesno = array(1 => _("Yes"), 0 => _("No"));
 	printSelectInput("mapdrives", $yesno, $data["mapdrives"]);
 	print "          </TD>\n";
 	print "          <TD></TD>\n";
 	print "        </TR>\n";
 	print "        <TR>\n";
-	print "          <TH align=right>Map Local Printers:</TH>\n";
+	print _("          <TH align=right>Map Local Printers:</TH>\n");
 	print "          <TD>\n";
 	printSelectInput("mapprinters", $yesno, $data["mapprinters"]);
 	print "          </TD>\n";
 	print "          <TD></TD>\n";
 	print "        </TR>\n";
 	print "        <TR>\n";
-	print "          <TH align=right>Map Local Serial Ports:</TH>\n";
+	print _("          <TH align=right>Map Local Serial Ports:</TH>\n");
 	print "          <TD>\n";
 	printSelectInput("mapserial", $yesno, $data["mapserial"]);
 	print "          </TD>\n";
@@ -244,14 +244,14 @@ function userpreferences() {
 	$cont = addContinuationsEntry('confirmrdpprefs', array(), SECINDAY, 1, 1, 1);
 	print "      <INPUT type=hidden name=continuation value=\"$cont\">\n";
 	print "      <div align=center>\n";
-	print "      <INPUT type=submit value=\"Submit Changes\">\n";
+	print _("      <INPUT type=submit value=\"Submit Changes\">\n");
 	print "      </div>\n";
 	print "      </FORM>\n";
 	print "      </fieldset>\n";
 
 	print "      <div id=uiprefs class=shown>\n";
 	print "      <fieldset>\n";
-	print "      <legend>General Preferences</legend>\n";
+	print _("      <legend>General Preferences</legend>\n");
 	print "      <FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
 	$cdata = array();
 	if($user['showallgroups']) {
@@ -262,12 +262,12 @@ function userpreferences() {
 		$selected['affiliation'] = 'checked';
 		$selected['allgroups'] = '';
 	}
-	print "      <p>View User Groups:<br>\n";
+	print _("      <p>View User Groups:<br>\n");
 	print "      <INPUT type=radio id=r1 name=groupview value=affiliation ";
-	print "{$selected['affiliation']}><label for=r1>matching my affiliation";
+	print "{$selected['affiliation']}" . _("><label for=r1>matching my affiliation");
 	print "</label><br>\n";
 	print "      <INPUT type=radio id=r2 name=groupview value=allgroups ";
-	print "{$selected['allgroups']}><label for=r2>from all affiliations";
+	print "{$selected['allgroups']}" . _("><label for=r2>from all affiliations");
 	print "</label></p>\n";
 	if($user['emailnotices']) {
 		$selected['enabled'] = 'checked';
@@ -277,16 +277,16 @@ function userpreferences() {
 		$selected['enabled'] = '';
 		$selected['disabled'] = 'checked';
 	}
-	print "      <p>Send email notifications about reservations:<br>\n";
+	print _("      <p>Send email notifications about reservations:<br>\n");
 	print "      <INPUT type=radio id=r3 name=emailnotify value=2 ";
-	print "{$selected['enabled']}><label for=r3>Enabled";
+	print "{$selected['enabled']}" . _("><label for=r3>Enabled");
 	print "</label><br>\n";
 	print "      <INPUT type=radio id=r4 name=emailnotify value=1 ";
-	print "{$selected['disabled']}><label for=r4>Disabled";
+	print "{$selected['disabled']}" . _("><label for=r4>Disabled");
 	print "</label></p>\n";
 	$cont = addContinuationsEntry('submitgeneralprefs', $cdata, SECINDAY, 1, 0);
 	print "      <INPUT type=hidden name=continuation value=\"$cont\">\n";
-	print "      <INPUT type=submit value=\"Submit General Preferences\">\n";
+	print _("      <INPUT type=submit value=\"Submit General Preferences\">\n");
 	print "      </FORM>\n";
 	print "      </fieldset>\n";
 	print "      </div>\n";
@@ -316,64 +316,64 @@ function confirmUserPrefs($type) {
 	}
 
 	if($data["audiomode"] == "none")
-		$audio = "None";
+		$audio = _("None");
 	else
-		$audio = "Use my speakers";
+		$audio = _("Use my speakers");
 	if($data["mapdrives"] == 0)
-		$drives = "No";
+		$drives = _("No");
 	else
-		$drives = "Yes";
+		$drives = _("Yes");
 	if($data["mapprinters"] == 0)
-		$printers = "No";
+		$printers = _("No");
 	else
-		$printers = "Yes";
+		$printers = _("Yes");
 	if($data["mapserial"] == 0)
-		$serial = "No";
+		$serial = _("No");
 	else
-		$serial = "Yes";
+		$serial = _("Yes");
 
 	print "<DIV align=center>\n";
 	if($type == 0) {
-		print "<H2>Personal Information</H2>\n";
-		print "<H3>Submit the following changes?</H3>\n";
+		print _("<H2>Personal Information</H2>\n");
+		print _("<H3>Submit the following changes?</H3>\n");
 		print "<table>\n";
 		print "  <TR>\n";
-		print "    <TH align=right>Preferred Name:</TH>\n";
+		print _("    <TH align=right>Preferred Name:</TH>\n");
 		print "    <TD>" . $data["preferredname"] . "</TD>\n";
 		print "  </TR>\n";
 		print "</table>\n";
 		if($user['affiliation'] == 'Local' &&
 		   ! empty($data['newpassword'])) {
-			print "New password will be submitted<br>\n";
+			print _("New password will be submitted<br>\n");
 		}
 	}
 	elseif($type == 1) {
-		print "<H2>RDP File Preferences</H2>\n";
-		print "<H3>Submit the following changes?</H3>\n";
+		print _("<H2>RDP File Preferences</H2>\n");
+		print _("<H3>Submit the following changes?</H3>\n");
 		print "<table>\n";
 		print "  <TR>\n";
-		print "    <TH align=right>Resolution:</TH>\n";
+		print _("    <TH align=right>Resolution:</TH>\n");
 		print "    <TD>" . $data["resolution"] . "</TD>\n";
 		print "  </TR>\n";
 		print "  <TR>\n";
-		print "    <TH align=right>Color Depth:</TH>\n";
+		print _("    <TH align=right>Color Depth:</TH>\n");
 		$colordepth = array("8" => "8", "16" => "16", "24" => "24", "32" => "32 (Vista only)");
 		print "    <TD>" . $colordepth[$data["bpp"]] . "</TD>\n";
 		print "  </TR>\n";
 		print "  <TR>\n";
-		print "    <TH align=right>Audio:</TH>\n";
+		print _("    <TH align=right>Audio:</TH>\n");
 		print "    <TD>$audio</TD>\n";
 		print "  </TR>\n";
 		print "  <TR>\n";
-		print "    <TH align=right>Map Local Drives:</TH>\n";
+		print _("    <TH align=right>Map Local Drives:</TH>\n");
 		print "    <TD>$drives</TD>\n";
 		print "  </TR>\n";
 		print "  <TR>\n";
-		print "    <TH align=right>Map Local Printers:</TH>\n";
+		print _("    <TH align=right>Map Local Printers:</TH>\n");
 		print "    <TD>$printers</TD>\n";
 		print "  </TR>\n";
 		print "  <TR>\n";
-		print "    <TH align=right>Map Local Serial Ports:</TH>\n";
+		print _("    <TH align=right>Map Local Serial Ports:</TH>\n");
 		print "    <TD>$serial</TD>\n";
 		print "  </TR>\n";
 		print "</table>\n";
@@ -384,14 +384,14 @@ function confirmUserPrefs($type) {
 	print "      <FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
 	$cont = addContinuationsEntry('submituserprefs', $data, SECINWEEK, 0, 0);
 	print "      <INPUT type=hidden name=continuation value=\"$cont\">\n";
-	print "      <INPUT type=submit value=Submit>\n";
+	print _("      <INPUT type=submit value=Submit>\n");
 	print "      </FORM>\n";
 	print "    </TD>\n";
 	print "    <TD>\n";
 	print "      <FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
 	$cont = addContinuationsEntry('userpreferences');
 	print "      <INPUT type=hidden name=continuation value=\"$cont\">\n";
-	print "      <INPUT type=submit value=Cancel>\n";
+	print _("      <INPUT type=submit value=Cancel>\n");
 	print "      </FORM>\n";
 	print "    </TD>\n";
 	print "  </TR>\n";
@@ -526,11 +526,11 @@ function processUserPrefsInput($checks=1
 
 	if(strlen($return["preferredname"]) > 25) {
 	   $submitErr |= PREFNAMEERR;
-	   $submitErrMsg[PREFNAMEERR] = "Preferred name can only be up to 25 characters";
+	   $submitErrMsg[PREFNAMEERR] = _("Preferred name can only be up to 25 characters");
 	}
 	if(! preg_match('/^[a-zA-Z ]*$/', $return["preferredname"])) {
 	   $submitErr |= PREFNAMEERR;
-	   $submitErrMsg[PREFNAMEERR] = "Preferred name can only contain letters and spaces";
+	   $submitErrMsg[PREFNAMEERR] = _("Preferred name can only contain letters and spaces");
 	}
 	if($user['affiliation'] == 'Local' && array_key_exists('newpassword', $_POST)) {
 		$return['newpassword'] = $_POST['newpassword'];
@@ -544,13 +544,13 @@ function processUserPrefsInput($checks=1
 		if(! empty($return['newpassword']) && ! empty($confirmpwd) &&
 		   ! validateLocalAccount($user['unityid'], $curr)) {
 			$submitErr |= LOCALPASSWORDERR;
-			$submitErrMsg[LOCALPASSWORDERR] = "Password incorrect";
+			$submitErrMsg[LOCALPASSWORDERR] = _("Password incorrect");
 		}
 		elseif((empty($return['newpassword']) && ! empty($confirmpwd)) ||
 		   (! empty($return['newpassword']) && empty($confirmpwd)) ||
 		   ($return['newpassword'] != $confirmpwd)) {
 			$submitErr |= LOCALPASSWORDERR;
-			$submitErrMsg[LOCALPASSWORDERR] = "Passwords do not match";
+			$submitErrMsg[LOCALPASSWORDERR] = _("Passwords do not match");
 		}
 	}
 	return $return;

Modified: incubator/vcl/trunk/web/.ht-inc/utils.php
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/utils.php?rev=1327259&r1=1327258&r2=1327259&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/utils.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/utils.php Tue Apr 17 20:01:13 2012
@@ -98,7 +98,7 @@ function initGlobals() {
 	$submitErr = 0;
 	$submitErrMsg = array();
 	$remoteIP = $_SERVER["REMOTE_ADDR"];
-	$days = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
+	$days = array(_('Sunday'), _('Monday'), _('Tuesday'), _('Wednesday'), _('Thursday'), _('Friday'), _('Saturday'));
 	$phpVerArr = explode('.', phpversion());
 	$phpVer = $phpVerArr[0];
 
@@ -179,7 +179,8 @@ function initGlobals() {
 			$mode != "xmlrpccall" &&
 			$mode != "xmlrpcaffiliations" &&
 			$mode != "selectauth" &&
-			$mode != "submitLogin") {
+			$mode != "submitLogin" &&
+			$mode != "changeLocale") {
 			$oldmode = $mode;
 			$mode = "auth";
 		}
@@ -208,7 +209,7 @@ function initGlobals() {
 		if(! $user = getUserInfo($userid)) {
 			// if first call to getUserInfo fails, try calling with $noupdate set
 			if(! $user = getUserInfo($userid, 1)) {
-				$ERRORS[1] = "Failed to get user info from database.  userid was $userid";
+				$ERRORS[1] = _("Failed to get user info from database.  userid was ") . "$userid";
 				abort(1);
 			}
 		}
@@ -513,6 +514,13 @@ function checkAccess() {
 							return;
 						}
 						break;
+					case 'serverProfiles':
+						if(! in_array("serverProfileAdmin", $user["privileges"])) {
+							$mode = "";
+							$actionFunction = "main";
+							return;
+						}
+						break;
 					case 'pickTimeTable':
 						$computermetadata = getUserComputerMetaData();
 						if(! count($computermetadata["platforms"]) ||
@@ -546,11 +554,16 @@ function checkAccess() {
 							return;
 						}
 						break;
-					case 'viewdocs':
-						if(! in_array("userGrant", $user["privileges"]) &&
-						   ! in_array("resourceGrant", $user["privileges"]) &&
-						   ! in_array("nodeAdmin", $user["privileges"]) &&
-						   ! in_array($user['id'], $docreaders)) {
+					case 'siteMaintenance':
+						if(! checkUserHasPerm('Schedule Site Maintenance')) {
+							$mode = "";
+							$actionFunction = "main";
+							return;
+						}
+						break;
+					case 'dashboard':
+						if(! checkUserHasPerm('View Dashboard (global)') &&
+						   ! checkUserHasPerm('View Dashboard (affiliation only)')) {
 							$mode = "";
 							$actionFunction = "main";
 							return;
@@ -642,18 +655,19 @@ function maintenanceCheck() {
 			$skin = strtolower($_COOKIE['VCLSKIN']);
 		else
 			$skin = DEFAULTTHEME;
+		setVCLLocale();
 		require_once("themes/$skin/page.php");
 		printHTMLHeader();
-		print "<h2>Site Currently Under Maintenance</h2>\n";
+		print _("<h2>Site Currently Under Maintenance</h2>\n");
 		if(! empty($msg)) {
 			$msg = htmlentities($msg);
 			$msg = preg_replace("/\n/", "<br>\n", $msg);
 			print "$msg<br>\n";
 		}
 		else
-			print "This site is currently in maintenance.<br>\n";
-		$niceend = date('l, F jS, Y \a\t g:i A', $end);
-		print "The maintenance is scheduled to end <b>$niceend</b>.<br><br><br>\n";
+			print _("This site is currently in maintenance.<br>\n");
+		$niceend = strftime('%A, %x, %l:%M %P', $end);
+		print _("The maintenance is scheduled to end <b>") . "$niceend" . _("</b>.<br><br><br>\n");
 		printHTMLFooter();
 		exit;
 	}
@@ -682,21 +696,21 @@ function maintenanceNotice() {
 				$_SESSION['usersessiondata'] = array();
 				return;
 			}
-			$nicestart = date('g:i A \o\n l, F jS, Y', $start);
-			$niceend = date('g:i A \o\n l, F jS, Y', datetimeToUnix($item['end']));
+			$nicestart = strftime('%A, %x, %l:%M %P', $start);
+			$niceend = strftime('%A, %x, %l:%M %P', datetimeToUnix($item['end']));
 			print "<div id=\"maintenancenotice\">\n";
-			print "<b>NOTICE</b>: This site will be down for maintenance during ";
-			print "the following times:<br><br>\n";
-			print	"Start: $nicestart<br>\n";
-			print "End: $niceend.<br><br>\n";
+			print _("<b>NOTICE</b>: This site will be down for maintenance during ");
+			print _("the following times:<br><br>\n");
+			print	_("Start") . ": $nicestart<br>\n";
+			print _("End") . ": $niceend.<br><br>\n";
 			if($item['allowreservations']) {
-				print "You will be able to access your reserved machines during ";
-				print "this maintenance. However, you will not be able to access ";
-				print "information on how to connect to them.<br>\n";
+				print _("You will be able to access your reserved machines during ");
+				print _("this maintenance. However, you will not be able to access ");
+				print _("information on how to connect to them.<br>\n");
 			}
 			else {
-				print "You will not be able to access any of your reservations ";
-				print "during this maintenance.<br>\n";
+				print _("You will not be able to access any of your reservations ");
+				print _("during this maintenance.<br>\n");
 			}
 			print "</div>\n";
 			return;
@@ -720,6 +734,7 @@ function clearPrivCache() {
 	$_SESSION['compstateflow'] = array();
 	$_SESSION['usersessiondata'] = array();
 	unset($_SESSION['user']);
+	unset($_SESSION['locales']);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -795,12 +810,12 @@ function stopSession() {
 ////////////////////////////////////////////////////////////////////////////////
 function main() {
 	global $user, $authed, $mode;
-	print "<H2>Welcome to the Virtual Computing Lab</H2>\n";
+	print _("<H2>Welcome to the Virtual Computing Lab</H2>\n");
 	if($authed) {
 		if(! empty($user['lastname']) && ! empty($user['preferredname']))
-			print "Hello {$user["preferredname"]} {$user['lastname']}<br><br>\n";
+			print _("Hello ") . "{$user["preferredname"]} {$user['lastname']}<br><br>\n";
 		elseif(! empty($user['lastname']) && ! empty($user['firstname']))
-			print "Hello {$user["firstname"]} {$user['lastname']}<br><br>\n";
+			print _("Hello ") . "{$user["firstname"]} {$user['lastname']}<br><br>\n";
 		$tmp = array_values($user['groups']);
 		if(count($tmp) == 1 && $tmp[0] == 'nodemo') {
 			print "Your account is a demo account that has expired. ";
@@ -812,16 +827,16 @@ function main() {
 		$requests = getUserRequests("all", $user["id"]);
 		if($num = count($requests)) {
 			if($num == 1) {
-				print "You currently have $num reservation</a>.<br>\n";
+				print _("You currently have ") . "$num" . _(" reservation</a>.<br>\n");
 			}
 			else {
-				print "You currently have $num reservations</a>.<br>\n";
+				print _("You currently have ") . "$num" . _(" reservations</a>.<br>\n");
 			}
 		}
 		else {
-			print "You do not have any current reservations.<br>\n";
+			print _("You do not have any current reservations.<br>\n");
 		}
-		print "Please make a selection from the menu to continue.<br>\n";
+		print _("Please make a selection from the menu to continue.<br>\n");
 	}
 	else {
 		print "Click the <b>Log in to VCL</b> button at the top right part of ";
@@ -883,10 +898,10 @@ function abort($errcode, $query="") {
 		$message .= getBacktraceString(FALSE);
 		$mailParams = "-f" . ENVELOPESENDER;
 		mail(ERROREMAIL, "Error with VCL pages ($errcode)", $message, '', $mailParams);
-		print "An error has occurred.  If this problem persists, please email ";
-		print "<a href=\"mailto:" . HELPEMAIL . "?Subject=Problem%20With%20VCL\">";
-		print HELPEMAIL . "</a> for further assistance.  Please include the ";
-		print "steps you took that led up to this problem in your email message.";
+		print _("An error has occurred.  If this problem persists, please email ");
+		print "<a href=\"mailto:" . HELPEMAIL . "?Subject=" . _("Problem%20With%20VCL") . "\">";
+		print HELPEMAIL . "</a> " . _("for further assistance.  Please include the ");
+		print _("steps you took that led up to this problem in your email message.");
 	}
 	dbDisconnect();
 	printHTMLFooter();
@@ -1483,11 +1498,24 @@ function getImageConnectMethods($imageid
 ///
 ////////////////////////////////////////////////////////////////////////////////
 function getImageConnectMethodTexts($imageid, $revisionid=0) {
+	global $locale;
+	$descfield = 'description';
+	$textfield = 'connecttext';
+	if(! preg_match('/^en/', $locale)) {
+		$query = "DESC connectmethod";
+		$qh = doQuery($query, 101);
+		while($row = mysql_fetch_assoc($qh)) {
+			if($row['Field'] == "description_$locale")
+				$descfield = "description_$locale";
+			if($row['Field'] == "connecttext_$locale")
+				$textfield = "connecttext_$locale";
+		}
+	}
 	if($revisionid == 0)
 		$revisionid = getProductionRevisionid($imageid);
 	$query = "SELECT c.id, "
-	       .        "c.description, "
-	       .        "c.connecttext, "
+	       .        "c.`$descfield` AS description, "
+	       .        "c.`$textfield` AS connecttext, "
 	       .        "cm.disabled "
 	       . "FROM connectmethod c, "
 	       .      "connectmethodmap cm, "
@@ -1501,7 +1529,7 @@ function getImageConnectMethodTexts($ima
 	       .        "cm.OSid = o.id OR "
 	       .        "cm.imagerevisionid = $revisionid) "
 	       . "ORDER BY cm.disabled, "
-	       .          "c.description";
+	       .          "c.`$descfield`";
 	$methods = array();
 	$qh = doQuery($query, 101);
 	while($row = mysql_fetch_assoc($qh)) {
@@ -2894,7 +2922,7 @@ function getAffiliations() {
 	$qh = doQuery($query, 101);
 	$return = array();
 	while($row = mysql_fetch_assoc($qh))
-			$return[$row['id']] = $row['name'];
+		$return[$row['id']] = $row['name'];
 	return $return;
 }
 
@@ -3924,6 +3952,7 @@ function isAvailable($images, $imageid, 
 			       .       "c.procnumber >= i.minprocnumber AND "
 			       .       "c.procspeed >= i.minprocspeed AND "
 			       .       "c.network >= i.minnetwork AND "
+			       .       "c.deleted = 0 AND "
 			       .       "(c.type != 'virtualmachine' OR c.vmhostid IS NOT NULL) AND ";
 			if(! $ignoreprivileges)
 				$query .=   "c.id IN ($usercomputers) AND ";
@@ -4795,12 +4824,12 @@ function getRequestInfo($id, $returnNULL
 		# FIXME handle XMLRPC cases
 		if(! $printedHTMLheader) 
 			print $HTMLheader;
-		print "<h1>OOPS! - Reservation Has Expired</h1>\n";
-		print "The selected reservation is no longer available.  Go to ";
-		print "<a href=" . BASEURL . SCRIPT . "?mode=newRequest>New ";
-		print "Reservations</a><br>to request a new reservation or to ";
-		print "<a href=" . BASEURL . SCRIPT . "?mode=viewRequests>Current ";
-		print "Reservations</a> to select<br>another one that is available.";
+		print _("<h1>OOPS! - Reservation Has Expired</h1>\n");
+		print _("The selected reservation is no longer available.  Go to ");
+		print "<a href=" . BASEURL . SCRIPT . "?mode=newRequest>";
+		print _("New Reservations</a><br>to request a new reservation or to ");
+		print "<a href=" . BASEURL . SCRIPT . "?mode=viewRequests>";
+		print _("Current Reservations</a> to select<br>another one that is available.");
 		printHTMLFooter();
 		dbDisconnect();
 		exit;
@@ -6322,7 +6351,7 @@ function showTimeTable($links) {
 	}
 
 	print "<DIV align=center>\n";
-	print "<H2>Time Table</H2>\n";
+	print _("<H2>Time Table</H2>\n");
 	print "</DIV>\n";
 	$computeridrow = "";
 	$displayedids = array();
@@ -6359,17 +6388,17 @@ function showTimeTable($links) {
 	}
 	if(empty($displayedids)) {
 		if($links) {
-			print "There are currently no computers available that can run the application you selected.\n";
+			print _("There are currently no computers available that can run the application you selected.\n");
 		}
 		else {
-			print "There are no computers that meet the specified criteria\n";
+			print _("There are no computers that meet the specified criteria\n");
 		}
 		return;
 	}
 	if($showmessage) {
-		print "The time you have requested to use the environment is not ";
-		print "available. You may select from the green blocks of time to ";
-		print "select an available time slot to make a reservation.<br>\n";
+		print _("The time you have requested to use the environment is not ");
+		print _("available. You may select from the green blocks of time to ");
+		print _("select an available time slot to make a reservation.<br>\n");
 	}
 	print "<table summary=\"\">\n";
 	print "  <TR>\n";
@@ -6389,7 +6418,7 @@ function showTimeTable($links) {
 		               'imaging' => $imaging);
 		$cont = addContinuationsEntry($mode, $cdata, SECINDAY);
 		print "<INPUT type=hidden name=continuation value=\"$cont\">\n";
-		print "<INPUT type=submit value=Previous>\n";
+		print _("<INPUT type=submit value=Previous>\n");
 		print "</FORM>\n";
 	}
 	print "</TD>\n";
@@ -6408,7 +6437,7 @@ function showTimeTable($links) {
 		               'imaging' => $imaging);
 		$cont = addContinuationsEntry($mode, $cdata, SECINDAY);
 		print "<INPUT type=hidden name=continuation value=\"$cont\">\n";
-		print "<INPUT type=submit value=Next>\n";
+		print _("<INPUT type=submit value=Next>\n");
 		print "</FORM>\n";
 	}
 	print "</TD>\n";
@@ -6500,8 +6529,8 @@ function showTimeTable($links) {
 					print "          <TD bgcolor=\"#ff0000\"><font color=\"#ff0000\">used</font></TD>\n";
 				}
 				else {
-					$title = "User: " . $timeslots[$id][$stamp]["unityid"]
-					       . " Image: " . $timeslots[$id][$stamp]["prettyimage"];
+					$title = _("User: ") . $timeslots[$id][$stamp]["unityid"]
+					       . _(" Image: ") . $timeslots[$id][$stamp]["prettyimage"];
 					$ttdata = array('start' => $argstart,
 					                'end' => $argend,
 					                'imageid' => $imageid,
@@ -6541,7 +6570,7 @@ function showTimeTable($links) {
 		               'imaging' => $imaging);
 		$cont = addContinuationsEntry($mode, $cdata, SECINDAY);
 		print "<INPUT type=hidden name=continuation value=\"$cont\">\n";
-		print "<INPUT type=submit value=Previous>\n";
+		print _("<INPUT type=submit value=Previous>\n");
 		print "</FORM>\n";
 	}
 	print "</TD>\n";
@@ -6560,7 +6589,7 @@ function showTimeTable($links) {
 		               'imaging' => $imaging);
 		$cont = addContinuationsEntry($mode, $cdata, SECINDAY);
 		print "<INPUT type=hidden name=continuation value=\"$cont\">\n";
-		print "<INPUT type=submit value=Next>\n";
+		print _("<INPUT type=submit value=Next>\n");
 		print "</FORM>\n";
 	}
 	print "</TD>\n";
@@ -7871,19 +7900,13 @@ function printArray($array) {
 ///
 ////////////////////////////////////////////////////////////////////////////////
 function prettyDatetime($stamp, $showyear=0) {
-	if(preg_match('/^[\d]+$/', $stamp)) {
-		if($showyear)
-			$return = date('l, M#jS,#Y, g:i a', $stamp);
-		else
-			$return = date('l, M#jS, g:i a', $stamp);
-	}
-	else {
-		if($showyear)
-			$return = date('l, M#jS,#Y, g:i a', datetimeToUnix($stamp));
-		else
-			$return = date('l, M#jS, g:i a', datetimeToUnix($stamp));
-	}
-	$return = str_replace('#', '&nbsp;', $return);
+	global $locale;
+	if(! preg_match('/^[\d]+$/', $stamp))
+		$stamp = datetimeToUnix($stamp);
+	if($showyear)
+		$return = strftime('%A, %b&nbsp;%-d,&nbsp;%Y, %l:%M %P', $stamp);
+	else
+		$return = strftime('%A, %b&nbsp;%-d, %l:%M %P', $stamp);
 	return $return;
 }
 
@@ -7900,15 +7923,15 @@ function prettyDatetime($stamp, $showyea
 ////////////////////////////////////////////////////////////////////////////////
 function minToHourMin($min) {
 	if($min < 60)
-		return $min . " minutes";
+		return $min . _(" minutes");
 	elseif($min == 60)
-		return "1 hour";
+		return _("1 hour");
 	elseif($min % 60 == 0)
-		return sprintf("%d hours", $min / 60);
+		return sprintf("%d " . _("hours"), $min / 60);
 	elseif($min % 30 == 0)
-		return sprintf("%.1f hours", $min / 60);
+		return sprintf("%.1f " . _("hours"), $min / 60);
 	else
-		return sprintf("%.2f hours", $min / 60);
+		return sprintf("%.2f " . _("hours"), $min / 60);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -7947,18 +7970,18 @@ function secToMinSec($sec) {
 ////////////////////////////////////////////////////////////////////////////////
 function prettyLength($minutes) {
 	if($minutes < 60)
-		return (int)$minutes . " minutes";
+		return (int)$minutes . _(" minutes");
 	elseif($minutes == 60)
-		return "1 hour";
+		return _("1 hour");
 	elseif($minutes % 60 == 0)
-		return $minutes / 60 . " hours";
+		return $minutes / 60 . _(" hours");
 	else {
 		$hours = (int)($minutes / 60);
 		$min = (int)($minutes % 60);
 		if($hours == 1)
-			return "$hours hour, $min minutes";
+			return "$hours " . _("hour") . ", $min " . _("minutes");
 		else
-			return "$hours hours, $min minutes";
+			return "$hours " . _("hours") . ", $min " . _("minutes");
 	}
 }
 
@@ -8718,15 +8741,15 @@ function getUserMaxTimes($uid=0) {
 function getReservationLengths($max) {
 	$lengths = array();
 	if($max >= 30)
-		$lengths["30"] = "30 minutes";
+		$lengths["30"] = "30 " . _("minutes");
 	if($max >= 45)
-		$lengths["45"] = "45 minutes";
+		$lengths["45"] = "45 " . _("minutes");
 	if($max >= 60)
-		$lengths["60"] = "1 hour";
+		$lengths["60"] = _("1 hour");
 	for($i = 120; $i <= $max && $i < 2880; $i += 120)
-		$lengths[$i] = $i / 60 . " hours";
+		$lengths[$i] = $i / 60 . _(" hours");
 	for($i = 2880; $i <= $max; $i += 1440)
-		$lengths[$i] = $i / 1440 . " days";
+		$lengths[$i] = $i / 1440 . _(" days");
 	return $lengths;
 }
 
@@ -8745,10 +8768,10 @@ function getReservationLength($length) {
 	if($length < 60)
 		return ($length % 60) - ($length % 60 % 15) . " minutes";
 	if($length < 120)
-		return "1 hour";
+		return _("1 hour");
 	if($length < 2880)
-		return intval($length / 60) . " hours";
-	return intval($length / 1440) . " days";
+		return intval($length / 60) . _(" hours");
+	return intval($length / 1440) . _(" days");
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -8764,16 +8787,16 @@ function getReservationLength($length) {
 ////////////////////////////////////////////////////////////////////////////////
 function getReservationExtenstion($length) {
 	if($length < 60)
-		return ($length % 60) - ($length % 60 % 15) . " minutes";
+		return ($length % 60) - ($length % 60 % 15) . _(" minutes");
 	if($length < 75)
-		return "1 hour";
+		return _("1 hour");
 	if($length < 120) {
 		$min = ($length % 60) - ($length % 60 % 15);
-		return sprintf('%d:%02d hours', intval($length / 60), $min);
+		return sprintf('%d:%02d ' . _('hours'), intval($length / 60), $min);
 	}
 	if($length < 2880)
-		return intval($length / 60) . " hours";
-	return intval($length / 1440) . " days";
+		return intval($length / 60) . _(" hours");
+	return intval($length / 1440) . _(" days");
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -9540,26 +9563,26 @@ function continuationsError() {
 	if(array_key_exists('error', $contdata)) {
 		switch($contdata['error']) {
 		case 'invalid input':
-			print "<h2>Error: Invalid Input</h2><br>\n";
-			print "You submitted input invalid for this web site. If you have no ";
-			print "idea why this happened and the problem persists, please email ";
-			print "<a href=\"mailto:" . HELPEMAIL . "?Subject=Problem%20With%20VCL\">";
-			print HELPEMAIL . "</a> for further assistance.  Please include the ";
-			print "steps you took that led up to this problem in your email message.";
+			print _("<h2>Error: Invalid Input</h2><br>\n");
+			print _("You submitted input invalid for this web site. If you have no ");
+			print _("idea why this happened and the problem persists, please email ");
+			print "<a href=\"mailto:" . HELPEMAIL . "?Subject=" . _("Problem%20With%20VCL\">");
+			print HELPEMAIL . "</a> " . _("for further assistance.  Please include the ");
+			print _("steps you took that led up to this problem in your email message.");
 			break;
 		case 'continuation does not exist':
 		case 'expired':
-			print "<h2>Error: Invalid Input</h2><br>\n";
-			print "You submitted expired data to this web site. Please restart the ";
-			print "steps you were following without using your browser's <strong>";
-			print "Back</strong> button.";
+			print _("<h2>Error: Invalid Input</h2><br>\n");
+			print _("You submitted expired data to this web site. Please restart the ");
+			print _("steps you were following without using your browser's <strong>");
+			print _("Back</strong> button.");
 			break;
 		default:
-			print "<h2>Error: Invalid Input</h2><br>\n";
-			print "An error has occurred.  If this problem persists, please email ";
-			print "<a href=\"mailto:" . HELPEMAIL . "?Subject=Problem%20With%20VCL\">";
-			print HELPEMAIL . "</a> for further assistance.  Please include the ";
-			print "steps you took that led up to this problem in your email message.";
+			print _("<h2>Error: Invalid Input</h2><br>\n");
+			print _("An error has occurred.  If this problem persists, please email ");
+			print "<a href=\"mailto:" . HELPEMAIL . "?Subject=" . _("Problem%20With%20VCL\">");
+			print HELPEMAIL . "</a> " . _("for further assistance.  Please include the ");
+			print _("steps you took that led up to this problem in your email message.");
 		}
 	}
 	if(! array_key_exists('noHTMLwrappers', $contdata) ||
@@ -10227,103 +10250,98 @@ function getNavMenu($inclogout, $inchome
 	$rt = '';
 	if($inchome) {
 		$rt .= menulistLI('home');
-		$rt .= "<a href=\"$homeurl\">HOME</a></li>\n";
+		$rt .= "<a href=\"$homeurl\">" . _("HOME") . "</a></li>\n";
 	}
 	$rt .= menulistLI('newReservations');
 	$rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=newRequest\">";
-	$rt .= "New Reservation</a></li>\n";
+	$rt .= _("New Reservation</a></li>\n");
 	if(in_array("imageCheckOut", $user["privileges"]) ||
 		in_array("imageAdmin", $user["privileges"])) {
 		$rt .= menulistLI('currentReservations');
 		$rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=viewRequests\">";
-		$rt .= "Current Reservations</a></li>\n";
+		$rt .= _("Current Reservations</a></li>\n");
 	}
 	$rt .= menulistLI('blockAllocations');
 	$rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=blockAllocations\">";
-	$rt .= "Block Allocations</a></li>\n";
+	$rt .= _("Block Allocations</a></li>\n");
 	$rt .= menulistLI('userPreferences');
 	$rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=userpreferences\">";
-	$rt .= "User Preferences</a></li>\n";
+	$rt .= _("User Preferences</a></li>\n");
 	if(in_array("groupAdmin", $user["privileges"])) {
 		$rt .= menulistLI('manageGroups');
 		$rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=viewGroups\">";
-		$rt .= "Manage Groups</a></li>\n";
+		$rt .= _("Manage Groups</a></li>\n");
 	}
 	if(in_array("imageAdmin", $user["privileges"])) {
 		$rt .= menulistLI('manageImages');
 		$rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=selectImageOption\">";
-		$rt .= "Manage Images</a></li>\n";
+		$rt .= _("Manage Images</a></li>\n");
 	}
 	if(in_array("scheduleAdmin", $user["privileges"])) {
 		$rt .= menulistLI('manageSchedules');
 		$rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=viewSchedules\">";
-		$rt .= "Manage Schedules</a></li>\n";
+		$rt .= _("Manage Schedules</a></li>\n");
 	}
 	if(in_array("computerAdmin", $user["privileges"])) {
 		$rt .= menulistLI('manageComputers');
 		$rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=selectComputers\">";
-		$rt .= "Manage Computers</a></li>\n";
+		$rt .= _("Manage Computers</a></li>\n");
 	}
 	if(in_array("mgmtNodeAdmin", $user["privileges"])) {
 		$rt .= menulistLI('managementNodes');
 		$rt .= "<a href=\"" . BASEURL . SCRIPT;
-		$rt .= "?mode=selectMgmtnodeOption\">Management Nodes</a></li>\n";
+		$rt .= _("?mode=selectMgmtnodeOption\">Management Nodes</a></li>\n");
 	}
 	if(in_array("serverProfileAdmin", $user["privileges"])) {
 		$rt .= menulistLI('serverProfiles');
 		$rt .= "<a href=\"" . BASEURL . SCRIPT;
-		$rt .= "?mode=serverProfiles\">Server Profiles</a></li>\n";
+		$rt .= "?mode=serverProfiles\">" . _("Server Profiles") . "</a></li>\n";
 	}
 	if(count($computermetadata["platforms"]) &&
 		count($computermetadata["schedules"])) {
 		$rt .= menulistLI('timeTable');
 		$rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=pickTimeTable\">";
-		$rt .= "View Time Table</a></li>\n";
+		$rt .= _("View Time Table</a></li>\n");
 	}
 	if(in_array("userGrant", $user["privileges"]) ||
 		in_array("resourceGrant", $user["privileges"]) ||
 		in_array("nodeAdmin", $user["privileges"])) {
 		$rt .= menulistLI('privileges');
 		$rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=viewNodes\">";
-		$rt .= "Privileges</a></li>\n";
+		$rt .= _("Privileges</a></li>\n");
 	}
 	if(checkUserHasPerm('User Lookup (global)') ||
 	   checkUserHasPerm('User Lookup (affiliation only)')) {
 		$rt .= menulistLI('userLookup');
 		$rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=userLookup\">";
-		$rt .= "User Lookup</a></li>\n";
+		$rt .= _("User Lookup</a></li>\n");
 	}
 	if(in_array("computerAdmin", $user["privileges"])) {
 		$rt .= menulistLI('vm');
 		$rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=editVMInfo\">";
-		$rt .= "Virtual Hosts</a></li>\n";
+		$rt .= _("Virtual Hosts</a></li>\n");
 	}
 	if(checkUserHasPerm('Schedule Site Maintenance')) {
 		$rt .= menulistLI('sitemaintenance');
 		$rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=siteMaintenance\">";
-		$rt .= "Site Maintenance</a></li>\n";
+		$rt .= _("Site Maintenance</a></li>\n");
 	}
 	$rt .= menulistLI('statistics');
 	$rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=selectstats\">";
-	$rt .= "Statistics</a></li>\n";
+	$rt .= _("Statistics</a></li>\n");
 	if(checkUserHasPerm('View Dashboard (global)') ||
 	   checkUserHasPerm('View Dashboard (affiliation only)')) {
 		$rt .= menulistLI('dashboard');
 		$rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=dashboard\">";
-		$rt .= "Dashboard</a></li>\n";
-	}
-	if(in_array("userGrant", $user["privileges"]) ||
-		in_array("resourceGrant", $user["privileges"]) ||
-		in_array("nodeAdmin", $user["privileges"]) ||
-		in_array($user['id'], $docreaders)) {
-		$rt .= menulistLI('codeDocumentation');
-		$rt .= "<a href=\"" . DOCUMENTATIONURL . "\">";
-		$rt .= "Documentation</a></li>\n";
+		$rt .= _("Dashboard") . "</a></li>\n";
 	}
+	$rt .= menulistLI('codeDocumentation');
+	$rt .= "<a href=\"" . DOCUMENTATIONURL . "\">";
+	$rt .= _("Documentation</a></li>\n");
 	if($inclogout) {
 		$rt .= menulistLI('authentication');
 		$rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=logout\">";
-		$rt .= "Logout</a></li>\n";
+		$rt .= _("Logout</a></li>\n");
 	}
 	return $rt;
 }
@@ -10362,7 +10380,7 @@ function getExtraCSS() {
 ///
 ////////////////////////////////////////////////////////////////////////////////
 function getDojoHTML($refresh) {
-	global $mode, $actions, $skin;
+	global $mode, $actions, $skin, $locale;
 	$filename = '';
 	$dojoRequires = array();
 
@@ -10649,13 +10667,14 @@ function getDojoHTML($refresh) {
 	if(! empty($filename))
 		$customfile = sprintf("<script type=\"text/javascript\" src=\"dojo/dojo/%s\"></script>\n", $filename);
 	$rt = '';
+	$jslocale = strtolower(str_replace('_', '-', $locale));
 	switch($mode) {
 		case "connectRequest":
 			$rt .= "<style type=\"text/css\">\n";
 			$rt .= "   @import \"themes/$skin/css/dojo/$skin.css\";\n";
 			$rt .= "</style>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"dojo/dojo/dojo.js\"\n";
-			$rt .= "   djConfig=\"parseOnLoad: true\">\n";
+			$rt .= "   djConfig=\"parseOnLoad: true, locale: '$jslocale'\">\n";
 			$rt .= "</script>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"js/requests.js\"></script>\n";
 			$rt .= $customfile;
@@ -10677,7 +10696,7 @@ function getDojoHTML($refresh) {
 			$rt .= "</style>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"js/requests.js\"></script>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"dojo/dojo/dojo.js\"\n";
-			$rt .= "   djConfig=\"parseOnLoad: true\">\n";
+			$rt .= "   djConfig=\"parseOnLoad: true, locale: '$jslocale'\">\n";
 			$rt .= "</script>\n";
 			$rt .= $customfile;
 			$rt .= "<script type=\"text/javascript\">\n";
@@ -10703,9 +10722,9 @@ function getDojoHTML($refresh) {
 			$rt .= "<style type=\"text/css\">\n";
 			$rt .= "   @import \"themes/$skin/css/dojo/$skin.css\";\n";
 			$rt .= "</style>\n";
-			$rt .= "<script type=\"text/javascript\" src=\"js/requests.js\"></script>\n";
+         $rt .= "<script type=\"text/javascript\" src=\"js/requests.js\"></script>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"dojo/dojo/dojo.js\"\n";
-			$rt .= "   djConfig=\"parseOnLoad: true\">\n";
+			$rt .= "   djConfig=\"parseOnLoad: true, locale: '$jslocale'\">\n";
 			$rt .= "</script>\n";
 			$rt .= $customfile;
 			$rt .= "<script type=\"text/javascript\">\n";
@@ -10729,7 +10748,7 @@ function getDojoHTML($refresh) {
 			$rt .= "</style>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"js/blockallocations.js\"></script>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"dojo/dojo/dojo.js\"\n";
-			$rt .= "   djConfig=\"parseOnLoad: true\">\n";
+			$rt .= "   djConfig=\"parseOnLoad: true, locale: '$jslocale'\">\n";
 			$rt .= "</script>\n";
 			$rt .= $customfile;
 			$rt .= "<script type=\"text/javascript\">\n";
@@ -10756,7 +10775,7 @@ function getDojoHTML($refresh) {
 			$rt .= "</style>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"js/blockallocations.js\"></script>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"dojo/dojo/dojo.js\"\n";
-			$rt .= "   djConfig=\"parseOnLoad: true\">\n";
+			$rt .= "   djConfig=\"parseOnLoad: true, locale: '$jslocale'\">\n";
 			$rt .= "</script>\n";
 			$rt .= $customfile;
 			$rt .= "<script type=\"text/javascript\">\n";
@@ -10774,7 +10793,7 @@ function getDojoHTML($refresh) {
 			$rt .= "</style>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"js/blockallocations.js\"></script>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"dojo/dojo/dojo.js\"\n";
-			$rt .= "   djConfig=\"parseOnLoad: true\">\n";
+			$rt .= "   djConfig=\"parseOnLoad: true, locale: '$jslocale'\">\n";
 			$rt .= "</script>\n";
 			$rt .= $customfile;
 			$rt .= "<script type=\"text/javascript\">\n";
@@ -10794,7 +10813,7 @@ function getDojoHTML($refresh) {
 			$rt .= "</style>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"js/schedules.js\"></script>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"dojo/dojo/dojo.js\"\n";
-			$rt .= "   djConfig=\"parseOnLoad: true\">\n";
+			$rt .= "   djConfig=\"parseOnLoad: true, locale: '$jslocale'\">\n";
 			$rt .= "</script>\n";
 			$rt .= $customfile;
 			$rt .= "<script type=\"text/javascript\">\n";
@@ -10819,7 +10838,7 @@ function getDojoHTML($refresh) {
 			$rt .= "</style>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"js/images.js\"></script>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"dojo/dojo/dojo.js\"\n";
-			$rt .= "   djConfig=\"parseOnLoad: true\">\n";
+			$rt .= "   djConfig=\"parseOnLoad: true, locale: '$jslocale'\">\n";
 			$rt .= "</script>\n";
 			$rt .= $customfile;
 			$rt .= "<script type=\"text/javascript\">\n";
@@ -10852,7 +10871,7 @@ function getDojoHTML($refresh) {
 			$rt .= "</style>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"js/images.js\"></script>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"dojo/dojo/dojo.js\"\n";
-			$rt .= "   djConfig=\"parseOnLoad: true\">\n";
+			$rt .= "   djConfig=\"parseOnLoad: true, locale: '$jslocale'\">\n";
 			$rt .= "</script>\n";
 			$rt .= $customfile;
 			$rt .= "<script type=\"text/javascript\">\n";
@@ -10879,7 +10898,7 @@ function getDojoHTML($refresh) {
 			$rt .= "   @import \"dojo/dojox/grid/resources/Grid.css\";\n";
 			$rt .= "</style>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"dojo/dojo/dojo.js\"\n";
-			$rt .= "   djConfig=\"parseOnLoad: true\">\n";
+			$rt .= "   djConfig=\"parseOnLoad: true, locale: '$jslocale'\">\n";
 			$rt .= "</script>\n";
 			$rt .= $customfile;
 			$rt .= "<script type=\"text/javascript\">\n";
@@ -10908,7 +10927,7 @@ function getDojoHTML($refresh) {
 			$rt .= "   @import \"themes/$skin/css/dojo/$skin.css\";\n";
 			$rt .= "</style>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"dojo/dojo/dojo.js\"\n";
-			$rt .= "   djConfig=\"parseOnLoad: true\">\n";
+			$rt .= "   djConfig=\"parseOnLoad: true, locale: '$jslocale'\">\n";
 			$rt .= "</script>\n";
 			$rt .= $customfile;
 			$rt .= "<script type=\"text/javascript\">\n";
@@ -10928,7 +10947,7 @@ function getDojoHTML($refresh) {
 			$rt .= "<script type=\"text/javascript\" src=\"js/serverprofiles.js\"></script>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"js/requests.js\"></script>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"dojo/dojo/dojo.js\"\n";
-			$rt .= "   djConfig=\"parseOnLoad: true\">\n";
+			$rt .= "   djConfig=\"parseOnLoad: true, locale: '$jslocale'\">\n";
 			$rt .= "</script>\n";
 			$rt .= $customfile;
 			$rt .= "<script type=\"text/javascript\">\n";
@@ -10950,7 +10969,7 @@ function getDojoHTML($refresh) {
 			$rt .= "</style>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"js/computers.js\"></script>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"dojo/dojo/dojo.js\"\n";
-			$rt .= "   djConfig=\"parseOnLoad: true\">\n";
+			$rt .= "   djConfig=\"parseOnLoad: true, locale: '$jslocale'\">\n";
 			$rt .= "</script>\n";
 			$rt .= $customfile;
 			$rt .= "<script type=\"text/javascript\">\n";
@@ -10976,7 +10995,7 @@ function getDojoHTML($refresh) {
 			$rt .= "</style>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"js/computers.js\"></script>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"dojo/dojo/dojo.js\"\n";
-			$rt .= "   djConfig=\"parseOnLoad: true\">\n";
+			$rt .= "   djConfig=\"parseOnLoad: true, locale: '$jslocale'\">\n";
 			$rt .= "</script>\n";
 			$rt .= $customfile;
 			$rt .= "<script type=\"text/javascript\">\n";
@@ -11002,7 +11021,7 @@ function getDojoHTML($refresh) {
 			$rt .= "</style>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"js/vm.js\"></script>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"dojo/dojo/dojo.js\"\n";
-			$rt .= "   djConfig=\"parseOnLoad: true\">\n";
+			$rt .= "   djConfig=\"parseOnLoad: true, locale: '$jslocale'\">\n";
 			$rt .= "</script>\n";
 			$rt .= $customfile;
 			$rt .= "<script type=\"text/javascript\">\n";
@@ -11025,7 +11044,7 @@ function getDojoHTML($refresh) {
 			$rt .= "</style>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"js/privileges.js\"></script>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"dojo/dojo/dojo.js\"\n";
-			$rt .= "   djConfig=\"parseOnLoad: true\">\n";
+			$rt .= "   djConfig=\"parseOnLoad: true, locale: '$jslocale'\">\n";
 			$rt .= "</script>\n";
 			$rt .= $customfile;
 			$rt .= "<script type=\"text/javascript\">\n";
@@ -11042,7 +11061,7 @@ function getDojoHTML($refresh) {
 			$rt .= "</style>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"js/sitemaintenance.js\"></script>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"dojo/dojo/dojo.js\"\n";
-			$rt .= "   djConfig=\"parseOnLoad: true\">\n";
+			$rt .= "   djConfig=\"parseOnLoad: true, locale: '$jslocale'\">\n";
 			$rt .= "</script>\n";
 			$rt .= $customfile;
 			$rt .= "<script type=\"text/javascript\">\n";
@@ -11058,7 +11077,7 @@ function getDojoHTML($refresh) {
 			$rt .= "</style>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"js/statistics.js\"></script>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"dojo/dojo/dojo.js\"\n";
-			$rt .= "   djConfig=\"parseOnLoad: true\">\n";
+			$rt .= "   djConfig=\"parseOnLoad: true, locale: '$jslocale'\">\n";
 			$rt .= "</script>\n";
 			$rt .= $customfile;
 			$rt .= "<script type=\"text/javascript\">\n";
@@ -11076,7 +11095,7 @@ function getDojoHTML($refresh) {
 			$rt .= "</style>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"js/dashboard.js\"></script>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"dojo/dojo/dojo.js\"\n";
-			$rt .= "   djConfig=\"parseOnLoad: true\">\n";
+			$rt .= "   djConfig=\"parseOnLoad: true, locale: '$jslocale'\">\n";
 			$rt .= "</script>\n";
 			$rt .= $customfile;
 			$rt .= "<script type=\"text/javascript\">\n";
@@ -11093,7 +11112,7 @@ function getDojoHTML($refresh) {
 			$rt .= "   @import \"themes/$skin/css/dojo/$skin.css\";\n";
 			$rt .= "</style>\n";
 			$rt .= "<script type=\"text/javascript\" src=\"dojo/dojo/dojo.js\"\n";
-			$rt .= "   djConfig=\"parseOnLoad: true\">\n";
+			$rt .= "   djConfig=\"parseOnLoad: true, locale: '$jslocale'\">\n";
 			$rt .= "</script>\n";
 			$rt .= $customfile;
 			$rt .= "<script type=\"text/javascript\">\n";
@@ -11121,4 +11140,149 @@ function printHTMLFooter() {
 	print getFooter();
 }
 
+////////////////////////////////////////////////////////////////////////////////
+///
+/// \fn changeLocale()
+///
+/// \brief sets a cookie for the locale and redirects back to the site
+///
+////////////////////////////////////////////////////////////////////////////////
+function changeLocale() {
+	global $locale;
+	$newlocale = getContinuationVar('locale');
+	$oldmode = getContinuationVar('oldmode');
+	$authtype = getContinuationVar('authtype', '');
+	$locale = $newlocale;
+	setcookie("VCLLOCALE", $locale, (time() + (86400 * 31)), "/", COOKIEDOMAIN);
+	$extra = '';
+	if($oldmode == 'selectauth' && ! empty($authtype))
+		$extra = "&authtype=$authtype";
+	header("Location: " . BASEURL . SCRIPT . "?mode=$oldmode$extra");
+	dbDisconnect();
+	exit;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+///
+/// \fn setVCLLocale()
+///
+/// \brief sets a cookie for the locale; configures php for the locale
+///
+////////////////////////////////////////////////////////////////////////////////
+function setVCLLocale() {
+	global $locale;
+	# set a cookie for the locale if it has not been set already
+	if(! array_key_exists('VCLLOCALE', $_COOKIE)) {
+		setcookie("VCLLOCALE", 'en_US', (time() + (86400 * 31)), "/", COOKIEDOMAIN);
+		$locale = DEFAULTLOCALE;
+	}
+	// if a cookie has already been set, just update the expiration time for it
+	else {
+		setcookie("VCLLOCALE", $_COOKIE['VCLLOCALE'], (time() + (86400 * 31)), "/", COOKIEDOMAIN);
+		$locale = $_COOKIE['VCLLOCALE'];
+	}
+	
+	#putenv('LC_ALL=' . $locale);
+	# use UTF8 encoding for any locales other than English (we may just be able
+	#   to always use UTF8)
+	if(preg_match('/^en/', $locale))
+		setlocale(LC_ALL,  $locale);
+	else
+		setlocale(LC_ALL,  $locale . '.UTF8');
+	bindtextdomain('vcl', './locale');
+	textdomain('vcl');
+	bind_textdomain_codeset('vcl', 'UTF-8');
+}
+
+////////////////////////////////////////////////////////////////////////////////
+///
+/// \fn getSelectLanguagePulldown()
+///
+/// \return HTML for a select drop down
+///
+/// \brief generates HTML for a select drop down for changing the locale of
+/// the site
+///
+////////////////////////////////////////////////////////////////////////////////
+function getSelectLanguagePulldown() {
+	global $locale, $user, $remoteIP, $mode, $authMechs;
+	$tmp = explode('/', $_SERVER['SCRIPT_FILENAME']);
+	array_pop($tmp);
+	array_push($tmp, 'locale');
+
+	$locales = getFSlocales();
+
+	if(count($locales) < 1)
+		return '';
+
+	if(! is_array($user))
+		$user['id'] = 0;
+
+	$rt  = "<FORM name=\"localeform\" action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
+	$rt .= "<select name=\"continuation\" onChange=\"document.localeform.submit();\">\n";
+	$cdata = array('IP' => $remoteIP, 'oldmode' => $mode);
+	if($mode == 'selectauth') {
+		$type = processInputVar('authtype', ARG_STRING);
+		if(! empty($type) && array_key_exists($type, $authMechs))
+			$cdata['authtype'] = $type;
+	}
+	foreach($locales as $dir => $lang) {
+		$cdata['locale'] = $dir;
+		$tmp = explode('/', $dir);
+		$testlocale = array_pop($tmp);
+		$cont = addContinuationsEntry('changeLocale', $cdata, 300);
+		if($locale == $testlocale)
+			$rt .= "<option value=\"$cont\" selected>{$lang}</option>\n";
+		else
+			$rt .= "<option value=\"$cont\">{$lang}</option>\n";
+	}
+	$rt .= "</select>\n";
+	$rt .= "</form> \n";
+	return $rt;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+///
+/// \fn getFSlocales()
+///
+/// \return an array of locales supported in the filesystem where the key is
+/// the locale and the value is the name of the locale/language
+///
+/// \brief looks for supported locales in the filesystem and returns a list of
+/// them
+///
+////////////////////////////////////////////////////////////////////////////////
+function getFSlocales() {
+	if(isset($_SESSION) && array_key_exists('locales', $_SESSION))
+		return $_SESSION['locales'];
+	$tmp = explode('/', $_SERVER['SCRIPT_FILENAME']);
+	array_pop($tmp);
+	$mainpath = implode('/', $tmp);
+	array_push($tmp, 'locale');
+	$localedir = implode('/', $tmp);
+	$dirs = glob("{$localedir}/*");
+	$locales = array('en_US' => 'English');
+	foreach($dirs as $dir) {
+		if(! file_exists("{$dir}/LC_MESSAGES/vcl.mo"))
+			continue;
+		if(! file_exists("{$dir}/language"))
+			continue;
+		$fh = fopen("{$dir}/language", 'r');
+		if(! ($line = fgetss($fh))) {
+			fclose($fh);
+			continue;
+		}
+		fclose($fh);
+		$lang = htmlspecialchars(strip_tags(trim($line)));
+		$tmp = explode('/', $dir);
+		$dir = array_pop($tmp);
+		if($dir == 'po_files')
+			continue;
+		if(! file_exists("{$mainpath}/js/nls/{$dir}/messages.js"))
+			continue;
+		$locales[$dir] = $lang;
+	}
+	$_SESSION['locales'] = $locales;
+	return $locales;
+}
 ?>

Modified: incubator/vcl/trunk/web/index.php
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/index.php?rev=1327259&r1=1327258&r2=1327259&view=diff
==============================================================================
--- incubator/vcl/trunk/web/index.php (original)
+++ incubator/vcl/trunk/web/index.php Tue Apr 17 20:01:13 2012
@@ -42,6 +42,7 @@ $cache['unityids'] = array();
 $cache['nodeprivs']['resources'] = array();
 $docreaders = array();
 $shibauthed = 0;
+$locale = '';
 
 require_once(".ht-inc/states.php");
 
@@ -55,6 +56,8 @@ dbConnect();
 
 initGlobals();
 
+setVCLLocale();
+
 $modes = array_keys($actions['mode']);
 $args = array_keys($actions['args']);
 $hasArg = 0;