[LON-CAPA-cvs] cvs: loncom /interface portfolio.pm

bisitz lon-capa-cvs-allow@mail.lon-capa.org
Mon, 21 Jan 2008 18:00:31 -0000


This is a MIME encoded message

--bisitz1200938431
Content-Type: text/plain

bisitz		Mon Jan 21 13:00:31 2008 EDT

  Modified files:              
    /loncom/interface	portfolio.pm 
  Log:
  Localization: Added missing &mt(...) and optimized some of the &mt() calls.
  Still to do: change usage of &mt() for
    - "...-based" phrases
    - "Action disallowed" messages
  
  
--bisitz1200938431
Content-Type: text/plain
Content-Disposition: attachment; filename="bisitz-20080121130031.txt"

Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.187 loncom/interface/portfolio.pm:1.188
--- loncom/interface/portfolio.pm:1.187	Mon Jan 21 06:36:07 2008
+++ loncom/interface/portfolio.pm	Mon Jan 21 13:00:30 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # portfolio browser
 #
-# $Id: portfolio.pm,v 1.187 2008/01/21 11:36:07 bisitz Exp $
+# $Id: portfolio.pm,v 1.188 2008/01/21 18:00:30 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -339,7 +339,7 @@
 		    undef($colspan);
                 }
 		$r->print('<tr class="LC_browser_folder"><td '.$colspan.'><img alt="'.&mt('closed folder').'" src="'.$iconpath.'folder_closed.gif" /></td>');
-                $r->print('<td>Go to ...</td>');
+                $r->print('<td>'.&mt('Go to ...').'</td>');
                 my %anchor_fields = (
                     'selectfile'    => $filename.'/',
                     'currentpath'   => $current_path.$filename.'/',
@@ -363,7 +363,7 @@
                         my %anchor_fields = (
                             'lockinfo' => $fullpath
                         );
-                        $line.='<td colspan="2">'.&make_anchor($url,\%anchor_fields,'Locked').'</td>';
+                        $line.='<td colspan="2">'.&make_anchor($url,\%anchor_fields,&mt('Locked')).'</td>';
 			$css_class= 'LC_browser_file_locked';
                     } else {
                         if (!$can_modify) {
@@ -381,7 +381,7 @@
                                 'rename' => $filename,
                                 currentpath => $current_path
                             );
-                            $line .= &make_anchor($url,\%anchor_fields,'Rename');
+                            $line .= &make_anchor($url,\%anchor_fields,&mt('Rename'));
                             $line .= '</td><td>'.&make_anchor($href_edit_location.$filename.'.meta',\%anchor_fields,$cat);
                             # '<a href="'.$href_edit_location.$filename.'.meta">'.$cat.'</a>';
                         }
@@ -543,7 +543,7 @@
     } else {
         if (scalar(@files)) {
             &open_form($r,$url);
-            $r->print('<p>'.&mt('Delete').' '.&display_file(undef,\@files).'?</p>');
+            $r->print('<p>'.&mt('Delete [_1]?',&display_file(undef,\@files)).'</p>');
             &close_form($r,$url);
         } else {
             $r->print("No file was checked to delete.<br />");
@@ -610,7 +610,7 @@
 sub delete_dir {
     my ($r,$url)=@_;
     &open_form($r,$url);
-    $r->print('<p>'.&mt('Delete').' '.&display_file().'?</p>');
+     $r->print('<p>'.&mt('Delete [_1]?',&display_file()).'</p>');
     &close_form($r,$url);
 } 
 
@@ -625,8 +625,10 @@
 					       $directory_name);
 					       
     if ($result ne 'ok') {
-	$r->print('<span class="LC_error"> An error occurred (dir) ('.$result.
-		  ') while trying to delete '.$directory_name.'</span><br />');
+	$r->print('<span class="LC_error">'
+                  .&mt('An error occurred (dir) ([_1]) while trying to delete [_2].'
+                       ,$result,$directory_name)
+                  .'</span><br />');
     } else {
         # now remove from recent
         &Apache::lonhtmlcommon::remove_recent($namespace,[$directory_name.'/']);
@@ -650,8 +652,8 @@
         $r->print(&done(undef,$url));
     } else {
         &open_form($r,$url);
-        $r->print('<p>'.&mt('Rename').' '.&display_file().' to 
-                   <input name="filenewname" type="input" size="50" />?</p>');
+        $r->print('<p>'.&mt('Rename [_1] to [_2]?', &display_file()
+                  , '<input name="filenewname" type="input" size="50" />').'</p>');
         &close_form($r,$url);
     }
 }
@@ -677,9 +679,9 @@
         $chg_access = &access_for_renamed($filenewname,$group,$udom,$uname);
     } else {      
 	$r->print('<span class="LC_error">'.
-		  &mt('An error occurred ([_1]) while trying to rename [_2]'
-		      .' to [_3]',$result,&display_file(),
-		      &display_file('',$filenewname)).'</span><br />');
+		  &mt('An error occurred ([_1]) while trying to rename [_2] to [_3]'
+                      ,$result,&display_file(),&display_file('',$filenewname))
+                  .'</span><br />');
         return;
     }
     if ($filenewname ne $env{'form.filenewname'}) {
@@ -782,7 +784,7 @@
                               $action);
         my $button_text = {
                         'continue' => &mt('Proceed'),
-                        'cancel' => &mt('Back to Directory'),
+                        'cancel' => &mt('Return to directory'),
                       };
         &close_form($r,$url,$button_text);
     } else {
@@ -810,7 +812,7 @@
         $todisplay{$scope}{$key} = $$access_controls{$key};
     }
     if ($aclcount) {
-        $r->print(&mt('<h4>Current access controls defined for this file:</h4>'));
+        $r->print('<h4>'.&mt('Current access controls defined for this file:').'</h4>');
         $r->print(&Apache::loncommon::start_data_table());
         $r->print(&Apache::loncommon::start_data_table_header_row());
         $r->print('<th>'.&mt('Access control').'</th><th>'.&mt('Dates available').
@@ -821,12 +823,12 @@
         &build_access_summary($r,$count,$chg,%todisplay);
         $r->print(&Apache::loncommon::end_data_table());
     } else {
-        $r->print(&mt('No access control settings currently exist for this file.<br />' ));
+        $r->print(&mt('No access controil settings currently exist for this file.').'<br />');
     }
     my %anchor_fields = (
         'currentpath' => $env{'form.currentpath'}
     );
-    $r->print('<br />'.&make_anchor($url, \%anchor_fields, &mt('Return to directory listing')));
+    $r->print('<br />'.&make_anchor($url, \%anchor_fields, &mt('Return to directory')));
     return;
 }
 
@@ -1031,7 +1033,7 @@
         &open_form($r,$url);
         foreach my $newitem ('course','domains','users') {
             if ($env{'form.new'.$newitem} > 0) {
-                $r->print('<br />'.&mt('Add new <b>[_1]-based</b> access control for portfolio file: <b>[_2]</b>',$newitem,$env{'form.currentpath'}.$env{'form.selectfile'}).'<br /><br />');
+                $r->print('<br />'.&mt('Add new <b>[_1]-based</b> access control for portfolio file: <b>[_2]</b>',&mt($newitem),$env{'form.currentpath'}.$env{'form.selectfile'}).'<br /><br />');
                 $firstitem = $totalnew;
                 $lastitem = $totalnew + $env{'form.new'.$newitem};
                 $totalnew = $lastitem;
@@ -1051,7 +1053,7 @@
         );
         $r->print('<br />'.&make_anchor($url, \%anchor_fields, &mt('Display all access settings for this file')));
         delete $anchor_fields{'access'};
-        $r->print('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&make_anchor($url,\%anchor_fields,&mt('Return to directory listing')));
+        $r->print('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&make_anchor($url,\%anchor_fields,&mt('Return to directory')));
     }
     return;
 }
@@ -1311,7 +1313,7 @@
     my $title = $type;
     $title =~ s/s$//;
     $title =~ s/^(\w)/uc($1)/e;
-    $r->print('<h3>'.&mt('[_1]-based conditional access: ',$title));
+    $r->print('<h3>'.&mt('[_1]-based conditional access: ',&mt($title)));
     if ($$acl_count{$type}) {
         $r->print($$acl_count{$type}.' ');
         if ($$acl_count{$type} > 1) {
@@ -1366,7 +1368,7 @@
         }
         $r->print(&Apache::loncommon::end_data_table());
     } else {
-        $r->print(&mt('No [_1]-based conditions defined.',$type).'<br />'
+        $r->print(&mt('No [_1]-based conditions defined.',&mt($type)).'<br />'
                   .&additional_item($type));
     }
     return;
@@ -1526,7 +1528,7 @@
 
 sub additional_item {
     my ($type) = @_;
-    my $output = &mt('Add new [_1] condition(s)?',$type).'&nbsp;'.&mt('Number to add: ').'<input type="text" name="new'.$type.'" size="3" value="0" />';
+    my $output = &mt('Add new [_1] condition(s)?',&mt($type)).'&nbsp;'.&mt('Number to add: ').'<input type="text" name="new'.$type.'" size="3" value="0" />';
     return $output;
 }
 
@@ -1781,7 +1783,7 @@
     } elsif ($found_file) {
         if ($locked_file) {
             my $msg = '<span class="LC_error">';
-            $msg .= &mt('Unable to upload [_1] a locked file by that name was found in [_2].','<span class="LC_filename">'.$fname.'</span>','<span class="LC_filename">'.$port_path.$env{'form.currentpath'}.'</span>');
+            $msg .= &mt('Unable to upload [_1]. A locked file by that name was found in [_2].','<span class="LC_filename">'.$fname.'</span>','<span class="LC_filename">'.$port_path.$env{'form.currentpath'}.'</span>');
             $msg .= '</span><br />';
             $msg .= &mt('You will be able to rename or delete existing [_1] after a grade has been assigned.','<span class="LC_filename">'.$fname.'</span>');
 	    return ('file_locked',$msg);
@@ -1821,8 +1823,8 @@
 					$port_path.$env{'form.currentpath'},
 					$mode,\%allfiles,\%codebase);
     if ($result !~ m|^/uploaded/|) {
-	$r->print('<span class="LC_error">'.'An error occurred ('.$result.
-		  ') while trying to upload '.&display_file().'</span><br />');
+	$r->print('<span class="LC_error">'.&mt('An error occurred ([_1]) while trying to upload [_2].'
+                  ,$result,&display_file()).'</span><br />');
 	$r->print(&done('Back',$url));
     } else {
 	if (%allfiles) {
@@ -1838,7 +1840,7 @@
 	    $r->print(&Apache::londocs::ask_for_embedded_content('/adm/portfolio',$state,\%allfiles,\%codebase,
 				      {'error_on_invalid_names'   => 1,
 				       'ignore_remote_references' => 1,}));
-	    $r->print('<p>Or '.&done('Return to directory listing',$url).'</p>');
+	    $r->print('<p>Or '.&done('Return to directory',$url).'</p>');
 	} else {
 	    $r->print(&done(undef,$url));
 	}
@@ -1880,8 +1882,10 @@
 	    &Apache::lonnet::userfileupload('embedded_item_'.$i,'',
 					    $port_path.$path);
 	if ($result !~ m|^/uploaded/|) {
-	    $r->print('<span class="LC_error">'.'An error occurred ('.$result.
-		      ') while trying to upload '.$orig_uploaded_filename.' for embedded element '.$env{'form.embedded_orig_'.$i}.'</span><br />');
+	    $r->print('<span class="LC_error">'
+                      .&mt('An error occurred ([_1]) while trying to upload [_2] for embedded element [_3].'
+                           ,$result,$orig_uploaded_filename,$env{'form.embedded_orig_'.$i})
+                      .'</span><br />');
 	    next;
 	} else {
 	    $r->print("<p> Uploaded ".
@@ -1926,8 +1930,7 @@
 	    my %course_description = 
 		&Apache::lonnet::coursedescription($$array_item[1]);
 	    if ( $course_description{'description'} ne '') {
-		$r->print(&mt('In the course: <strong>[_1]</strong><br />',
-			      $course_description{'description'}));
+		$r->print(&mt('In the course:').' <strong>'.$course_description{'description'}.'</strong><br />');
 	    }
         }
     }
@@ -1955,20 +1958,24 @@
         }
     }
     if ($found_file){
-    	    $r->print('<span class="LC_error">'.&mt('Unable to create a directory named').' <strong>'.$newdir.
-    	            '</strong>. '.&mt('A file or directory by that name already exists.').'</span><br />');
+    	    $r->print('<span class="LC_error">'
+                      .&mt('Unable to create a directory named [_1].','<strong>'.$newdir.'</strong>')
+                      .' '.&mt('A file or directory by that name already exists.').'</span><br />');
     } else {
         my ($uname,$udom) = &get_name_dom();
         my $port_path = &get_port_path();
         my $result=&Apache::lonnet::mkdiruserfile($uname,$udom,
 	         $port_path.$env{'form.currentpath'}.$newdir);
         if ($result ne 'ok') {
-    	    $r->print('<span class="LC_error">'.'An error occurred ('.$result.
-	    	      ') while trying to create a new directory '.&display_file().'</span><br />');
+    	    $r->print('<span class="LC_error">'
+                      .&mt('An error occurred ([_1]) while trying to create a new directory [_2].'
+                           ,$result,&display_file())
+                      .'</span><br />');
         }
     }
     if ($newdir ne $env{'form.newdir'}) {
-        $r->print(&mt("The new directory name was changed from:")."<br /><strong>".$env{'form.newdir'}."</strong> ".&mt('to')." <strong>$newdir </strong>");  
+        $r->print(&mt('The new directory name was changed from [_1] to [_2].'
+                      ,'<strong>'.$env{'form.newdir'}.'</strong>','<strong>'.$newdir.'</strong>'));  
     }
     $r->print(&done(undef,$url));
 }
@@ -2069,7 +2076,7 @@
         $rtnlink .= '?';
     }
     $rtnlink .= 'currentpath='.$escpath;
-    $r->print(&mt('<h3>Action disallowed</h3>'));
+    $r->print('<h3>'.&mt('Action disallowed').'</h3>');
     $r->print(&mt('You do not have sufficient privileges to [_1] ',
                   $longtext->{$priv}));
     if (defined($env{'form.group'})) {
@@ -2078,7 +2085,7 @@
     } else {
         $r->print(&mt('in this portfolio.'));
     }
-    $rtnlink .= '">'.&mt('Return to directory listing page').'</a>';
+    $rtnlink .= '">'.&mt('Return to directory').'</a>';
     $r->print('<br />'.$rtnlink);
     $r->print(&Apache::loncommon::end_page());
     return;
@@ -2170,7 +2177,7 @@
                 $r->print(&mt('Not a valid group for this course'));
                 $earlyout = 1;
             }
-            $title = &mt('Group files').' for '.$group; 
+            $title = &mt('Group files for [_1]', $group); 
         } else {
             $r->print(&mt('Invalid group'));
             $earlyout = 1;
@@ -2229,8 +2236,8 @@
     }
 	if (($env{'form.storeupl'}) & (!$env{'form.uploaddoc.filename'})){
    	    $r->print('<span class="LC_error">');
-   	    $r->print(&mt('No file was selected to upload. '));
-	    $r->print(&mt('To upload a file, click <strong>Browse...</strong> select a file, then click <strong>Upload</strong>.'));
+   	    $r->print(&mt('No file was selected to upload.').' ');
+	    $r->print(&mt('To upload a file, click <strong>Browse...</strong> and select a file, then click <strong>Upload</strong>.'));
 	    $r->print('</span>');
 	}
     if ($env{'form.meta'}) {

--bisitz1200938431--