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

bowersj2 lon-capa-cvs@mail.lon-capa.org
Thu, 09 Oct 2003 19:07:33 -0000


bowersj2		Thu Oct  9 15:07:33 2003 EDT

  Modified files:              
    /loncom/interface	lonhelper.pm 
  Log:
  Some more internationalization. I think I got all the hard stuff I know 
  how to do; there's still some parameterization and I'm not doing the 
  internationalization of the stuff Alex is doing in this commit.
  
  
Index: loncom/interface/lonhelper.pm
diff -u loncom/interface/lonhelper.pm:1.58 loncom/interface/lonhelper.pm:1.59
--- loncom/interface/lonhelper.pm:1.58	Thu Oct  9 14:24:32 2003
+++ loncom/interface/lonhelper.pm	Thu Oct  9 15:07:33 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # .helper XML handler to implement the LON-CAPA helper
 #
-# $Id: lonhelper.pm,v 1.58 2003/10/09 18:24:32 sakharuk Exp $
+# $Id: lonhelper.pm,v 1.59 2003/10/09 19:07:33 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1291,8 +1291,8 @@
     my $chosenValue = $ENV{'form.' . $self->{'variable'} . '.forminput'};
 
     if (!defined($chosenValue) && !$self->{'allowempty'}) {
-        $self->{ERROR_MSG} = "You must choose one or more choices to" .
-            " continue.";
+        $self->{ERROR_MSG} = 
+	    &mt("You must choose one or more choices to continue.");
         return 0;
     }
 
@@ -1595,25 +1595,28 @@
 
     # Display Hours and Minutes if they are called for
     if ($self->{'hoursminutes'}) {
+	# This needs parameterization for times.
+	my $am = &mt('a.m.');
+	my $pm = &mt('p.m.');
         # Build hour
         $result .= "<select name='${var}hour'>\n";
         $result .= "<option " . ($date->hour == 0 ? 'selected ':'') .
-            " value='0'>midnight</option>\n";
+            " value='0'>" . &mt('midnight') . "</option>\n";
         for ($i = 1; $i < 12; $i++) {
             if ($date->hour == $i) {
-                $result .= "<option selected value='$i'>$i a.m.</option>\n";
+                $result .= "<option selected value='$i'>$i $am</option>\n";
             } else {
-                $result .= "<option value='$i'>$i a.m</option>\n";
+                $result .= "<option value='$i'>$i $am</option>\n";
             }
         }
         $result .= "<option " . ($date->hour == 12 ? 'selected ':'') .
-            " value='12'>noon</option>\n";
+            " value='12'>" . &mt('noon') . "</option>\n";
         for ($i = 13; $i < 24; $i++) {
             my $printedHour = $i - 12;
             if ($date->hour == $i) {
-                $result .= "<option selected value='$i'>$printedHour p.m.</option>\n";
+                $result .= "<option selected value='$i'>$printedHour $pm</option>\n";
             } else {
-                $result .= "<option value='$i'>$printedHour p.m.</option>\n";
+                $result .= "<option value='$i'>$printedHour $pm</option>\n";
             }
         }
 
@@ -2024,7 +2027,7 @@
 no strict;
 @ISA = ("Apache::lonhelper::element");
 use strict;
-
+use Apache::lonlocal;
 
 
 BEGIN {
@@ -2098,11 +2101,14 @@
     }
 </script>
 SCRIPT
+
+        my $selectAllStudents = &mt('Select All Students'); 
+	my $unselectAllStudents = &mt('Unselect All Students');
         $buttons = <<BUTTONS;
 <br />
 <input type="button" onclick="checkactive()" value="Select Only Current Students" />
-<input type="button" onclick="checkall(true, '$var')" value="Select All Students" />
-<input type="button" onclick="checkall(false, '$var')" value="Unselect All Students" />
+<input type="button" onclick="checkall(true, '$var')" value="$selectAllStudents" />
+<input type="button" onclick="checkall(false, '$var')" value="$unselectAllStudents" />
 <input type="button" onclick="checksec(true)" value="Select for Section/Group">
 <input type="text" size="5" name="chksec">&nbsp;
 <input type="button" onclick="checksec(false)" value="Unselect for Section/Group">
@@ -2164,14 +2170,14 @@
 	}
     }
 
-    my $name = $self->{'coursepersonnel'} ? 'Name' : 'Student Name';
+    my $name = &mt($self->{'coursepersonnel'} ? 'Name' : 'Student Name');
     my $type = 'radio';
     if ($self->{'multichoice'}) { $type = 'checkbox'; }
     $result .= "<table cellspacing='2' cellpadding='2' border='0'>\n";
     $result .= "<tr><td></td><td align='center'><b>$name</b></td>".
-        "<td align='center'><b>Section</b></td>" . 
+        "<td align='center'><b>" . &mt('Section') . "</b></td>" . 
 	"<td align='center'><b>Status</b></td>" . 
-	"<td align='center'><b>Role</b></td>" .
+	"<td align='center'><b>" . &mt("Role") . "</b></td></tr>";
 	"<td align='center'><b>Username:Domain</b></td></tr>";
 
     my $checked = 0;
@@ -2209,8 +2215,8 @@
 
     my $result = $ENV{'form.' . $self->{'variable'} . '.forminput'};
     if (!$result) {
-        $self->{ERROR_MSG} = 'You must choose at least one student '.
-            'to continue.';
+        $self->{ERROR_MSG} = 
+	    &mt('You must choose at least one student to continue.');
         return 0;
     }
 
@@ -2276,6 +2282,7 @@
 no strict;
 @ISA = ("Apache::lonhelper::element");
 use strict;
+use Apache::lonlocal;
 
 use Apache::lonpubdir; # for getTitleString
 
@@ -2394,16 +2401,20 @@
     }
 </script>
 SCRIPT
+        my $selectAllFiles = &mt("Select All Files");
+	my $unselectAllFiles = &mt("Unselect All Files");
         $buttons = <<BUTTONS;
 <br /> &nbsp;
-<input type="button" onclick="checkall(true, '$var')" value="Select All Files" />
-<input type="button" onclick="checkall(false, '$var')" value="Unselect All Files" />
+<input type="button" onclick="checkall(true, '$var')" value="$selectAllFiles" />
+<input type="button" onclick="checkall(false, '$var')" value="$unselectAllFiles" />
 BUTTONS
 
+        my $selectAllPublished = &mt("Select All Published");
+	my $unselectAllPublished= &mt("UnselectAllPublished");
         if ($helper->{VARS}->{'construction'}) {
             $buttons .= <<BUTTONS;
-<input type="button" onclick="checkallclass(true, 'Published')" value="Select All Published" />
-<input type="button" onclick="checkallclass(false, 'Published')" value="Unselect All Published" />
+<input type="button" onclick="checkallclass(true, 'Published')" value="$selectAllPublished" />
+<input type="button" onclick="checkallclass(false, 'Published')" value="$unselectAllPublished" />
 <br /> &nbsp;
 BUTTONS
        }
@@ -2979,7 +2990,8 @@
 	}
 	
 	if (!@results) {
-	    $result .= '    <li>No changes were made to current settings.</li>';
+	    $result .= '    <li>' . 
+		&mt('No changes were made to current settings.') . '</li>';
 	}
 	
 	$result .= '</ul>';
@@ -2990,13 +3002,16 @@
 	if ($ENV{'course.'.$ENV{'request.course.id'}.'.clonedfrom'}) {
 	    $targetURL = '/adm/parmset?overview=1';
 	}
+	my $previous = HTML::Entities::encode(&mt("<- Previous"), '<>&"');
+	my $next = HTML::Entities::encode(&mt("Next ->"), '<>&"');
         $result .= "<center>\n" .
             "<form action='/adm/roles' method='post' target='loncapaclient'>\n" .
-            "<input type='button' onclick='history.go(-1)' value='&lt;- Previous' />" .
+            "<input type='button' onclick='history.go(-1)' value='$previous' />" .
             "<input type='hidden' name='orgurl' value='$targetURL' />" .
             "<input type='hidden' name='selectrole' value='1' />\n" .
             "<input type='hidden' name='" . $ENV{'request.role'} . 
-            "' value='1' />\n<input type='submit' value='Finish Course Initialization' />\n" .
+            "' value='1' />\n<input type='submit' value='" .
+	    &mt('Finish Course Initialization') . " />\n" .
             "</form></center>";
     }