[LON-CAPA-cvs] cvs: loncom /homework lonsimpleproblemedit.pm /interface loncommon.pm londocs.pm lonindexer.pm lonpickcourse.pm lonpreferences.pm /publisher lonrights.pm /xml lonxml.pm

bisitz bisitz@source.lon-capa.org
Wed, 02 Dec 2009 18:33:43 -0000


This is a MIME encoded message

--bisitz1259778823
Content-Type: text/plain

bisitz		Wed Dec  2 18:33:43 2009 EDT

  Modified files:              
    /loncom/homework	lonsimpleproblemedit.pm 
    /loncom/interface	loncommon.pm londocs.pm lonindexer.pm 
                     	lonpickcourse.pm lonpreferences.pm 
    /loncom/publisher	lonrights.pm 
    /loncom/xml	lonxml.pm 
  Log:
  Localization - Corrected "loncommon::select_form" usage:
  Only translate once but translate what needs to be translated. Don't translate custom text, e.g. custom folder names.
  Even avoid ISE: Unusual but possible special folder names on messages screen used to be misinterpreted.
  
  
--bisitz1259778823
Content-Type: text/plain
Content-Disposition: attachment; filename="bisitz-20091202183343.txt"

Index: loncom/homework/lonsimpleproblemedit.pm
diff -u loncom/homework/lonsimpleproblemedit.pm:1.29 loncom/homework/lonsimpleproblemedit.pm:1.30
--- loncom/homework/lonsimpleproblemedit.pm:1.29	Mon Oct 19 15:15:03 2009
+++ loncom/homework/lonsimpleproblemedit.pm	Wed Dec  2 18:33:20 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Simple Problem Parameter Setting "Editor"
 #
-# $Id: lonsimpleproblemedit.pm,v 1.29 2009/10/19 15:15:03 bisitz Exp $
+# $Id: lonsimpleproblemedit.pm,v 1.30 2009/12/02 18:33:20 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -128,10 +128,14 @@
     unless ($positions{$position}) {
 	$position='random';
     }
-    my $selectvalue=&Apache::loncommon::select_form
-	                                ($value,'value'.$number,%values);
-    my $selectposition=&Apache::loncommon::select_form
-                               ($position,'position'.$number,%positions);
+    my $selectvalue=&Apache::loncommon::select_form(
+                        $value,
+                        'value'.$number,
+                        &Apache::lonlocal::texthash(%values));
+    my $selectposition=&Apache::loncommon::select_form(
+                           $position,
+                           'position'.$number,
+                           &Apache::lonlocal::texthash(%positions));
     my $text=$qparms{$prefix.'text'.$number};
     my %lt=&Apache::lonlocal::texthash('foil'  => 'Foil',
 				       'value' => 'Value',
@@ -284,20 +288,22 @@
         );
         $r->print('<form name="simpleedit" method="post">');
 # Question Type        
-	my %questiontypes=('radio'  => 
-                               '1 out of N multiple choice (radio button)',
-			   'option' => 'Option response',
-                           'string' => 'Short string response',
-                           'essay'  => 'Essay, open end',
-                           'numerical' => 'Numerical response');
+        my %questiontypes=(
+               'radio'     => '1 out of N multiple choice (radio button)',
+               'option'    => 'Option Response',
+               'string'    => 'Short string response',
+               'essay'     => 'Essay, open end',
+               'numerical' => 'Numerical Response');
         $qtype=$qparms{$prefix.'questiontype'};
         unless (defined($qtype)) { $qtype='radio'; }
         unless ($questiontypes{$qtype}) { $qtype='radio'; }
         $r->print(
             '<fieldset style="width:400px;">'
            .'<legend>'.&mt('Question Type').'</legend>'
-           .&Apache::loncommon::select_form
-	            ($qtype,'questiontype',%questiontypes)
+           .&Apache::loncommon::select_form(
+                $qtype,
+                'questiontype',
+                &Apache::lonlocal::texthash(%questiontypes))
            .'</fieldset>'
         );
         $r->print(
@@ -318,8 +324,9 @@
             unless (defined($maxfoils)) { $maxfoils=10; }
             unless ($maxfoils=~/^\d+$/) { $maxfoils=10; }
             if ($maxfoils<=0) { $maxfoils=10; }
-	    my %randomizes=('yes' => 'Display foils in random order',
-			    'no'  => 'Display foils in order given');
+            my %randomizes=(
+                   'yes' => 'Display foils in random order',
+                   'no'  => 'Display foils in order given');
 	    my $randomize=$qparms{$prefix.'randomize'};
             unless (defined($randomize)) { $randomize='yes'; }
             unless ($randomizes{$randomize}) { $randomize='yes'; }
@@ -327,8 +334,10 @@
 		  '<table bgcolor="#00ee44" cellspacing="4" cellpadding="2" style="width:100%">'.
 	          '<tr><td>'.&mt('Max number of foils displayed').
 ': <input type="text" size="3" name="maxfoils" value="'.$maxfoils.'" />&nbsp;&nbsp;'.
-		      &Apache::loncommon::select_form
-		      ($randomize,'randomize',%randomizes).
+                      &Apache::loncommon::select_form(
+                          $randomize,
+                          'randomize',
+                          &Apache::lonlocal::texthash(%randomizes)).
 		  '</td></tr><tr><td bgcolor="#F0F0F0">');
 # Option Response: Options
 	    if ($qtype eq 'option') {
@@ -371,8 +380,10 @@
 	    $r->print(
 		  '<table bgcolor="#00ee44" cellspacing="4" cellpadding="2" style="width:100%">'.
 	          '<tr><td><label>'.&mt('Correct answer').': <input type="text" size="20" name="stringanswer" value="'.$stringanswer.'" /></label>&nbsp;&nbsp;'.
-		      &Apache::loncommon::select_form
-		      ($stringtype,'stringtype',%stringtypes).
+                      &Apache::loncommon::select_form(
+                          $stringtype,
+                          'stringtype',
+                          &Apache::lonlocal::texthash(%stringtypes)).
 		  '</td></tr></table><br />');
 # Hint
 	    $r->print(&hint());
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.921 loncom/interface/loncommon.pm:1.922
--- loncom/interface/loncommon.pm:1.921	Tue Dec  1 18:07:50 2009
+++ loncom/interface/loncommon.pm	Wed Dec  2 18:33:27 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.921 2009/12/01 18:07:50 bisitz Exp $
+# $Id: loncommon.pm,v 1.922 2009/12/02 18:33:27 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1877,7 +1877,7 @@
         $selectform.=
 	    '<option value="'.&HTML::Entities::encode($key,'"<>&').'" '.
             ($key eq $def ? 'selected="selected" ' : '').
-                ">".&mt($hash{$key})."</option>\n";
+                ">".$hash{$key}."</option>\n";
     }
     $selectform.="</select>";
     return $selectform;
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.410 loncom/interface/londocs.pm:1.411
--- loncom/interface/londocs.pm:1.410	Mon Nov  2 12:10:34 2009
+++ loncom/interface/londocs.pm	Wed Dec  2 18:33:27 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.410 2009/11/02 12:10:34 wenzelju Exp $
+# $Id: londocs.pm,v 1.411 2009/12/02 18:33:27 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2478,7 +2478,7 @@
 						      ('select_form_order' =>
 						       ['',1..$currentversion,'mostrecent'],
 						       '' => '',
-						       'mostrecent' => 'most recent',
+						       'mostrecent' => &mt('most recent'),
 						       map {$_,$_} (1..$currentversion))));
 	    $r->print('</span></td></tr><tr><td></td>');
 	    my $lastold=1;
Index: loncom/interface/lonindexer.pm
diff -u loncom/interface/lonindexer.pm:1.202 loncom/interface/lonindexer.pm:1.203
--- loncom/interface/lonindexer.pm:1.202	Tue Dec  1 18:07:50 2009
+++ loncom/interface/lonindexer.pm	Wed Dec  2 18:33:27 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Directory Indexer
 #
-# $Id: lonindexer.pm,v 1.202 2009/12/01 18:07:50 bisitz Exp $
+# $Id: lonindexer.pm,v 1.203 2009/12/02 18:33:27 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -518,13 +518,15 @@
         $select_file_categories{''} = &mt('All file types');
         foreach my $cat (@file_categories) {
 	    my $types = join(",",&Apache::loncommon::filecategorytypes($cat));
-	    $select_file_categories{$types} = $cat;
+	    $select_file_categories{$types} = &mt($cat);
 	    push(@select_form_order,$types);
 	}
         $select_file_categories{'select_form_order'} = \@select_form_order;
         my $type_element=
-	    &Apache::loncommon::select_form($typeselect,'only',
-					    %select_file_categories);
+            &Apache::loncommon::select_form(
+                $typeselect,
+                'only',
+                %select_file_categories);
         $type_element = '<label>'.&mt('File Type Displayed: [_1]',
 				      $type_element).'</label>';
         $r->print($type_element
Index: loncom/interface/lonpickcourse.pm
diff -u loncom/interface/lonpickcourse.pm:1.90 loncom/interface/lonpickcourse.pm:1.91
--- loncom/interface/lonpickcourse.pm:1.90	Wed Nov  4 14:12:19 2009
+++ loncom/interface/lonpickcourse.pm	Wed Dec  2 18:33:27 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a course
 #
-# $Id: lonpickcourse.pm,v 1.90 2009/11/04 14:12:19 raeburn Exp $
+# $Id: lonpickcourse.pm,v 1.91 2009/12/02 18:33:27 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -589,27 +589,29 @@
     $filter->{'sincefilter'} = $env{'form.sincefilter'};
     $filter->{'sincefilter'} =~ s/[^\d-]//g;
     if (!$filter->{'sincefilter'}) { $filter->{'sincefilter'}=-1; }
-    $sincefilterform=&Apache::loncommon::select_form($filter->{'sincefilter'},
-       'sincefilter',('-1'=>'',
-                      '86400' => 'today',
-                      '604800' => 'last week',
-                      '2592000' => 'last month',
-                      '7776000' => 'last three months',
-                      '15552000' => 'last six months',
-                      '31104000' => 'last year',
-                      'select_form_order' =>
-                      ['-1','86400','604800','2592000','7776000',
-                      '15552000','31104000']));
-
-    my %lt = (
-              'cac' => &mt("$type Activity"),
-              'cde' => &mt("$type Title"),
-              'cdo' => &mt("$type Domain"),
-              'ins' => &mt('Institutional Code'),
-              'inc' => &mt('Institutional Categorization'),
-              'cow' => &mt("$type Owner/Co-owner"),
-              'cop' => &mt("$type Personnel Includes"),
-              'cog' => &mt('Type')
+    $sincefilterform=&Apache::loncommon::select_form(
+        $filter->{'sincefilter'},
+        'sincefilter',
+        (      '-1' => '',
+            '86400' => &mt('today'),
+           '604800' => &mt('last week'),
+          '2592000' => &mt('last month'),
+          '7776000' => &mt('last three months'),
+         '15552000' => &mt('last six months'),
+         '31104000' => &mt('last year'),
+         'select_form_order' =>
+            ['-1','86400','604800','2592000','7776000',
+             '15552000','31104000']));
+
+    my %lt = &Apache::lonlocal::texthash(
+                'cac' => "$type Activity",
+                'cde' => "$type Title",
+                'cdo' => "$type Domain",
+                'ins' => 'Institutional Code',
+                'inc' => 'Institutional Categorization',
+                'cow' => "$type Owner/Co-owner",
+                'cop' => "$type Personnel Includes",
+                'cog' => 'Type',
              );
 
     if (($env{'form.form'} eq 'ccrs') || ($env{'form.form'} eq 'requestcrs')) {
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.178 loncom/interface/lonpreferences.pm:1.179
--- loncom/interface/lonpreferences.pm:1.178	Fri Oct 23 15:03:48 2009
+++ loncom/interface/lonpreferences.pm	Wed Dec  2 18:33:27 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Preferences
 #
-# $Id: lonpreferences.pm,v 1.178 2009/10/23 15:03:48 bisitz Exp $
+# $Id: lonpreferences.pm,v 1.179 2009/12/02 18:33:27 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -166,8 +166,11 @@
 	               = &Apache::loncommon::plainlanguagedescription($_);
 	}
     }
-    my $selectionbox=&Apache::loncommon::select_form($language,'language',
-						     %langchoices);
+    my $selectionbox=
+           &Apache::loncommon::select_form(
+               $language,
+               'language',
+               &Apache::lonlocal::texthash(%langchoices));
     $r->print(<<ENDLSCREEN);
 <form name="prefs" action="/adm/preferences" method="post">
 <input type="hidden" name="action" value="verify_and_change_languages" />
@@ -221,8 +224,11 @@
 		     'mimetex' => 'mimetex (Convert to Images)',
                      'raw' => 'Raw (Screen Reader)'
                      );
-    my $selectionbox=&Apache::loncommon::select_form($texengine,'texengine',
-						     %mathchoices);
+    my $selectionbox=
+           &Apache::loncommon::select_form(
+               $texengine,
+               'texengine',
+               &Apache::lonlocal::texthash(%mathchoices));
     my $jsMath_start=&Apache::lontexconvert::jsMath_header();
     my %lt=&Apache::lonlocal::texthash(
       'headline' => 'Change how math is displayed',
Index: loncom/publisher/lonrights.pm
diff -u loncom/publisher/lonrights.pm:1.28 loncom/publisher/lonrights.pm:1.29
--- loncom/publisher/lonrights.pm:1.28	Wed Dec  2 15:28:51 2009
+++ loncom/publisher/lonrights.pm	Wed Dec  2 18:33:35 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to show and edit custom distribution rights
 #
-# $Id: lonrights.pm,v 1.28 2009/12/02 15:28:51 bisitz Exp $
+# $Id: lonrights.pm,v 1.29 2009/12/02 18:33:35 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -211,7 +211,7 @@
   if ($constructmode) {
      $r->print(&Apache::loncommon::select_form('','action_0',
                                   ('' => '',
-				   'insertbelow' => 'Insert rule below')));
+                                   'insertbelow' => &mt('Insert rule below'))));
                                                 
   } else {
       $r->print('&nbsp;');
@@ -220,6 +220,7 @@
   if ($constructmode) {
       $r->print(&Apache::loncommon::select_form
                                  ($token->[2]->{'effect'},'effect_0',
+                                  &Apache::lonlocal::texthash
                                    ('allow' => 'allow',
                                     'deny'  => 'deny')));
   } else {
@@ -242,6 +243,7 @@
           if ($constructmode) {
              $r->print(&Apache::loncommon::select_form(
                     '','action_'.$rulecounter,
+                    &Apache::lonlocal::texthash
                     ('' => '', 
                      'delete' => 'Delete this rule',
                      'insertabove' => 'Insert rule above',
@@ -256,6 +258,7 @@
              $r->print(&Apache::loncommon::select_form
                                  ($token->[2]->{'effect'},
                                   'effect_'.$rulecounter,
+                                  &Apache::lonlocal::texthash
                                    ('allow' => 'allow',
                                     'deny'  => 'deny')));
           } else {
@@ -268,6 +271,7 @@
           if ($constructmode) {
               $r->print(&Apache::loncommon::select_form($type,
 							'type_'.$rulecounter,
+                            &Apache::lonlocal::texthash
 							('course' => 'Course',
 							 'user'   => 'User')));
           } else {
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.503 loncom/xml/lonxml.pm:1.504
--- loncom/xml/lonxml.pm:1.503	Mon Nov 30 23:22:47 2009
+++ loncom/xml/lonxml.pm	Wed Dec  2 18:33:43 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.503 2009/11/30 23:22:47 raeburn Exp $
+# $Id: lonxml.pm,v 1.504 2009/12/02 18:33:43 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1549,22 +1549,27 @@
     }
     my $output;
     unless ($env{'form.forceedit'}) {
-       $output .= '  
-           <span class="LC_nobreak">'.
+       $output .=
+           '<span class="LC_nobreak">'.
            &mt('Language:').' '.
-           &Apache::loncommon::select_form($env{'form.languages'},'languages',
-                                           %langchoices).'
-           </span>';
+           &Apache::loncommon::select_form(
+               $env{'form.languages'},
+               'languages',
+               &Apache::lonlocal::texthash(%langchoices)).
+           '</span>';
     }
-    $output .= '
-     <span class="LC_nobreak">'.
+    $output .=
+     ' <span class="LC_nobreak">'.
        &mt('Math Rendering:').' '.
-       &Apache::loncommon::select_form($env{'form.texengine'},'texengine',
-                                                     ('' => '',
-                                                      'tth' => 'tth (TeX to HTML)',
-                                                      'jsMath' => 'jsMath',
-                                                      'mimetex' => 'mimetex (Convert to Images)')).'
-     </span>';
+       &Apache::loncommon::select_form(
+           $env{'form.texengine'},
+           'texengine',
+           &Apache::lonlocal::texthash
+               (''        => '',
+                'tth'     => 'tth (TeX to HTML)',
+                'jsMath'  => 'jsMath',
+                'mimetex' => 'mimetex (Convert to Images)')).
+     '</span>';
     return $output;
 }
 

--bisitz1259778823--