[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm

bisitz lon-capa-cvs-allow@mail.lon-capa.org
Wed, 13 Aug 2008 09:10:45 -0000


This is a MIME encoded message

--bisitz1218618645
Content-Type: text/plain

bisitz		Wed Aug 13 05:10:45 2008 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm 
  Log:
  Localization:
  - Added missing &mt() calls
  - Optimized some &mt() calls
  - typo
  Note: untested (webserver restart ok)
  
  
--bisitz1218618645
Content-Type: text/plain
Content-Disposition: attachment; filename="bisitz-20080813051045.txt"

Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.238 loncom/homework/bridgetask.pm:1.239
--- loncom/homework/bridgetask.pm:1.238	Wed Aug  8 21:05:15 2007
+++ loncom/homework/bridgetask.pm	Wed Aug 13 05:10:44 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.238 2007/08/09 01:05:15 albertel Exp $
+# $Id: bridgetask.pm,v 1.239 2008/08/13 09:10:44 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -252,10 +252,10 @@
 	my ($entries,$ready,$locks)=&get_queue_counts('gradingqueue');
 	$result.="\n\t".'<table>'."\n\t\t".'<tr>';
 	if ($see_all || (!&section_restricted())) {
-	    $result.="\n\t\t\t".'<td rowspan="4">Specify a section: </td>'.
+	    $result.="\n\t\t\t".'<td rowspan="4">'.&mt('Specify a section:').' </td>'.
 		"\n\t\t\t".'<td rowspan="4">'.$sec_select."\n\t\t\t".'</td>';
 	} else {
-	    $result.="\n\t\t\t".'<td rowspan="4">Grading section: </td>'.
+	    $result.="\n\t\t\t".'<td rowspan="4">'.&mt('Grading section:').' </td>'.
 		"\n\t\t\t".'<td rowspan="4">'.$env{'request.course.sec'}."\n\t\t\t".'</td>';
 	}
 	$result.="\n\t\t\t".'<td>'.'<input type="submit" name="reviewagrading" value="'.
@@ -294,7 +294,7 @@
 
 sub add_request_another_attempt_button {
     my ($text)=@_;
-    if (!$text) { $text="Request another attempt"; }
+    if (!$text) { $text=&mt('Request another attempt'); }
     my $result;
     my $symb=&Apache::lonnet::symbread();
     # not a slot access based resource
@@ -306,13 +306,14 @@
     my ($slot_name,$slot)=&Apache::slotrequest::check_for_reservation($symb);
     my $action='get_reservation';
     if ($slot_name) {
-	$text="Change reservation.";
+	$text=&mt('Change reservation.');
 	$action='change_reservation';
 	my $description=&Apache::slotrequest::get_description($slot_name,
 							      $slot);
-	$result.=(<<STUFF);
-    <p> Will be next available: $description </p>
-STUFF
+	$result.='<p>'
+                .&mt('Will be next available:')
+                .' '.$description
+                .'</p>';
     }
     
     if ($env{'request.enc'}) { $symb=&Apache::lonenc::encrypted($symb); }
@@ -322,7 +323,7 @@
 	'<input type="hidden" name="symb" value="'.$symb.'" />'."\n\t\t".
 	'<input type="hidden" name="command" value="'.$action.'" />'."\n\t\t".
 	'<input type="submit" name="requestattempt" value="'.
-	&mt($text).'" />'."\n\t".
+	$text.'" />'."\n\t".
 	'</form>'."\n";
     return $result;
 }
@@ -540,17 +541,19 @@
     foreach my $file (@files) {
 	my $url="/uploaded/$domain/$user/portfolio$file";
 	if (! &Apache::lonnet::stat_file($url)) {
-	    $file = &mt('<span class="LC_error"> Nonexistent file:</span> '.
-			'<span class="LC_filename">[_1]</span>',$file);
-	    $msg .= "<p>Submitted non-existant file $file</p>\n";
+	    $file = '<span class="LC_error">'
+                   .&mt('[_1]Nonexistent file:[_2]'
+                       ,'<span class="LC_error"> '
+                       ,'</span> <span class="LC_filename">'.$file.'</span>');
+	    $msg .= "<p>".&mt('Submitted non-existant file [_1]',$file)."</p>\n";
 	} else {
 	    $file = '<span class="LC_filename">'.$file.'</span>';
-	    $msg .= "<p>Submitted file $file</p>\n";
+	    $msg .= "<p>".&mt('Submitted file [_1]',$file)."</p>\n";
 	}
 	$files .= '<li>'.$file.'</li>';
     }
     $files.='</ul>';
-    my $subject = "Submission message for $title";
+    my $subject = &mt('Submission message for [_1]',$title);
     my ($message_status,$comment_status);
     my $setting = $env{'course.'.$env{'request.course.id'}.'.task_messages'};
     $setting =~ s/^\s*(\S*)\s*$/$1/;
@@ -569,16 +572,14 @@
 	$comment_status = '<p>'.&mt('Message sent to instructor: [_1]',
 				    $comment_status).' </p>';
     }
-    return <<DONESCREEN;
-<h2>$title</h2>
-<p> Files submitted: $files </p>
-<p> You are now done with this Bridge Task </p>
-<hr />
-<p> <a href="/adm/logout">Logout</a> </p>
-<p> <a href="/adm/roles">Change to a different course</a> </p>
-$message_status
-$comment_status
-DONESCREEN
+    return "<h2>$title</h2>"
+          .'<p>'.&mt('Files submitted: [_1]',$files).'</p>'
+          .'<p>'.&mt('You are now done with this Bridge Task').'</p>'
+          .'<hr />'
+          .'<p><a href="/adm/logout">'.&mt('Logout').'</a></p>'
+.'<p><a href="/adm/roles">'.&mt('Change to a different course').'</a></p>'
+.$message_status
+.$comment_status
 
 }
 
@@ -1126,13 +1127,15 @@
 			"</p>\n";
 
 		    if ($bt_status eq 'pass')  {
-			$status.='<h2>You passed the '.$title.' given on '.
-			    $start_time.'</h2>';
+			$status.='<h2>'
+                                .&mt('You passed the [_1] given on [_2].',$title,$start_time)
+                                .'</h2>';
 			$status.=$question_status;
 		    }
 		    if ($bt_status eq 'fail')  {
-			$status.='<h2>You did not pass the '.$title.' given on '.
-			    $start_time.'</h2>';
+			$status.='<h2>'
+                                .&mt('You did not pass the [_1] given on [_2].',$title,$start_time)
+                                .'</h2>';
 			$status.=$question_status;
 			if (!$previous) {
 			    $status.=&add_request_another_attempt_button();
@@ -1561,8 +1564,10 @@
     my $classlist = &get_limited_classlist(\@chosen_sections);
 
     if (!(grep(/^all$/,@chosen_sections))) {
-	$result.='<p> Showing only sections <tt>'.join(', ',@chosen_sections).
-	    '</tt>.</p> '."\n";
+	$result.='<p>'
+                .&mt('Showing only sections [_1].'
+                    ,'<tt>'.join(', ',@chosen_sections).'</tt>')
+                ."</p>\n";
     }
 
     my ($view,$view_section);
@@ -1579,7 +1584,7 @@
     $result .= 
 	'<p><a href="/adm/flip?postdata=return:">'.
 	&mt('Return to resource').'</a></p><hr />'.
-	"\n<h3>Current Queue - $queue</h3>";
+	"\n<h3>".&mt('Current Queue - [_1]',$queue)."</h3>";
     my $regexp="^$symb\0";
     my %queue=&Apache::lonnet::dump($queue,$cdom,$cnum,$regexp);
     my ($tmp)=%queue;
@@ -1596,8 +1601,8 @@
     $result.=
 	&Apache::loncommon::start_data_table().
 	&Apache::loncommon::start_data_table_header_row();
-    if ($with_selects) { $result.="<th>Status</th><th></th>"; }
-    $result.="<th>user</th><th>data</th>".
+    if ($with_selects) { $result.='<th>'.&mt('Status').'</th><th></th>'; }
+    $result.='<th>'.&mt('User').'</th><th>'.&mt('Data').'</th>'.
 	&Apache::loncommon::end_data_table_header_row();
     foreach my $key (sort(keys(%queue))) {
 	my ($symb,$uname,$udom) = &decode_queue_key($key);
@@ -1644,7 +1649,7 @@
 								   'start');
 		    }
 		    my $me=$env{'user.name'}.':'.$env{'user.domain'};
-		    $status=&mt('Locked by <tt>[_1]</tt> [_2]',$locker,$time);
+		    $status=&mt('Locked by [_1] [_2]','<tt>'.$locker.'</tt>',$time);
 		    if ($me eq $locker) {
 			($action,$description)=('resume',&mt('Resume'));
 		    } else {
@@ -1679,9 +1684,11 @@
 	    }
 	    $result.= "<td>".$classlist->{$uname.':'.$udom}[&Apache::loncoursedata::CL_FULLNAME()].
 		" <tt>($uname:$udom)</tt> </td>";
-	    $result.='<td>'.$slot_text.' End time: '.
-		&Apache::lonlocal::locallocaltime($end_time).
-		"</td>".&Apache::loncommon::end_data_table_row();
+            $result.='<td>'.$slot_text.' '
+                    .&mt('End time: [_1]'
+                        ,&Apache::lonlocal::locallocaltime($end_time))
+                    .'</td>'
+                    .&Apache::loncommon::end_data_table_row();
 	}
     }
     $result.= &Apache::loncommon::end_data_table()."<hr />\n";
@@ -2034,8 +2041,10 @@
     
     my $result;
     if (!(grep(/^all$/,@chosen_sections))) {
-	$result.='<p> Showing only sections <tt>'.join(', ',@chosen_sections).
-	    '</tt>.</p> '."\n";
+        $result.='<p>'
+                .&mt('Showing only sections [_1].'
+                    ,'<tt>'.join(', ',@chosen_sections).'</tt>')
+                .'</p> '."\n";
     }
     $result.=&Apache::loncommon::start_data_table();
 
@@ -2432,10 +2441,14 @@
 		    ('sub' x $dimension{$dim}{'depth'}).'question';
 		$ucquestion =~ s/^(.)/uc($1)/e;
 		if ($dim_status eq 'pass') {
-		    $dim_info.='<h3>'.$ucquestion.' : you passed this '.$mandatory.' '.$question.'</h3>';
+                    $dim_info.='<h3>'.$ucquestion.' : '
+                              .&mt('you passed this [_1] [_2]',$mandatory,$question)
+                              .'</h3>';
 		}
 		if ($dim_status eq 'fail') {
-		    $dim_info.='<h3>'.$ucquestion.' : you did not pass this '.$mandatory.' '.$question.'</h3>';
+                    $dim_info.='<h3>'.$ucquestion.' : '
+                              .&mt('you did not pass this [_1] [_2]',$mandatory,$question)
+                              .'</h3>';
 		}
 		my %counts = &get_counts($dim,$instance,$parstack,
 					 $safeeval);
@@ -2634,6 +2647,7 @@
     }
     $status .= '.';
     if ($counts->{'opt'}) {
+        # FIXME &mt() missing!
 	$status .= ' You were required to pass '.$counts->{'opt_req'}.
 	    ' optional ';
 	if ($counts->{'opt_dim'} + $counts->{'man_dim'} < 1) {
@@ -3118,13 +3132,14 @@
     }
     if (!$valid) {
 	$msg.='<p><span class="LC_error">'
-	    .&mt("No valid poctors are defined.")
+	    .&mt("No valid proctors are defined.")
 	    .'</span></p>';
     }
     
     if (!$env{'form.proctordomain'}) { $env{'form.proctordomain'}=$domain; }
     my $uri = &Apache::lonenc::check_encrypt($env{'request.uri'});
     $uri = &HTML::Entities::encode($uri,'<>&"');
+    # FIXME &mt() missing!
     my $result= (<<ENDCHECKOUT);
 <h2>Proctor Validation</h2>
     <p>Your room's proctor needs to validate your access to this resource.</p>

--bisitz1218618645--