[LON-CAPA-cvs] cvs: loncom /interface lonhtmlcommon.pm lonprintout.pm /interface/statistics longradinganalysis.pm lonproblemanalysis.pm lonstathelpers.pm /localize/localize de.pm es.pm zh.pm

bisitz bisitz@source.lon-capa.org
Thu, 10 Jun 2010 16:14:45 -0000


This is a MIME encoded message

--bisitz1276186485
Content-Type: text/plain

bisitz		Thu Jun 10 16:14:45 2010 EDT

  Modified files:              
    /loncom/interface	lonhtmlcommon.pm lonprintout.pm 
    /loncom/interface/statistics	longradinganalysis.pm 
                                	lonproblemanalysis.pm 
                                	lonstathelpers.pm 
    /loncom/localize/localize	de.pm es.pm zh.pm 
  Log:
  Optimized status bar localization:
  Overhauled status text creation to allow proper translation.
      - Translate whole sentence instead of unhandy phrase fragments concatenation.
      - Simplified way of time text creation by using quant.
      - Removed code for not anymore supported old browsers (bug 1382).
      - Indirectly corrects mt() call with incorrect parameter (_2 -> _1)
  
  
  
--bisitz1276186485
Content-Type: text/plain
Content-Disposition: attachment; filename="bisitz-20100610161445.txt"

Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.277 loncom/interface/lonhtmlcommon.pm:1.278
--- loncom/interface/lonhtmlcommon.pm:1.277	Thu Jun 10 09:09:59 2010
+++ loncom/interface/lonhtmlcommon.pm	Thu Jun 10 16:14:34 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.277 2010/06/10 09:09:59 bisitz Exp $
+# $Id: lonhtmlcommon.pm,v 1.278 2010/06/10 16:14:34 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1071,21 +1071,7 @@
     #
     my $min = int($time_est/60);
     my $sec = $time_est % 60;
-    # 
-    my $str;
-    if ($min == 0 && $sec > 1) {
-        $str = '[_1] seconds';
-    } elsif ($min == 1 && $sec > 1) {
-        $str = '1 minute [_2] seconds';
-    } elsif ($min == 1 && $sec < 2) {
-        $str = '1 minute';
-    } elsif ($min < 10 && $sec > 1) {
-        $str = '[_1] minutes, [_2] seconds';
-    } elsif ($min >= 10 || $sec < 2) {
-        $str = '[_1] minutes';
-    }
-    $time_est = &mt($str,$min,$sec);
-    #
+
     my $lasttime = &Time::HiRes::time()-$$prog_state{'laststart'};
     if ($lasttime > 9) {
         $lasttime = int($lasttime);
@@ -1094,27 +1080,24 @@
     } else {
         $lasttime = sprintf("%3.2f",$lasttime);
     }
-    if ($lasttime == 1) {
-        $lasttime = '('.$lasttime.' '.&mt('second for').' '.$extraInfo.')';
-    } else {
-        $lasttime = '('.$lasttime.' '.&mt('seconds for').' '.$extraInfo.')';
-    }
-    #
-    my $user_browser = $env{'browser.type'} if (exists($env{'browser.type'}));
-    my $user_os      = $env{'browser.os'}   if (exists($env{'browser.os'}));
-    if (! defined($user_browser) || ! defined($user_os)) {
-        (undef,$user_browser,undef,undef,undef,$user_os) = 
-                           &Apache::loncommon::decode_user_agent();
-    }
-    if ($user_browser eq 'explorer' && $user_os =~ 'mac') {
-        $lasttime = '';
-    }
+
+    $sec = 0 if ($min >= 10); # Don't show seconds if remaining time >= 10 min.
+    $sec = 1 if ( ($min == 0) && ($sec == 0) ); # Little cheating: pretend to have 1 second remaining instead of 0 to have something to display
+
+    my $timeinfo =
+        &mt('[_1]/[_2]:'
+           .' [quant,_3,minute,minutes,] [quant,_4,second ,seconds ,]remaining'
+           .' ([quant,_5,second] for '.$extraInfo.')',
+            $current,
+            $$prog_state{'max'},
+            $min,
+            $sec,
+            $lasttime);
+
     &r_print($r,&Apache::lonhtmlcommon::scripttag(
         $$prog_state{'window'}.'.document.'.
         $$prog_state{'formname'}.'.'.
-        $$prog_state{'inputname'}.'.value="'.
-        $current.'/'.$$prog_state{'max'}.
-        ': '.$time_est.' '.&mt('remaining').' '.$lasttime.'";'
+        $$prog_state{'inputname'}.'.value="'.$timeinfo.'";'
     ));
     $$prog_state{'laststart'}=&Time::HiRes::time();
 }
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.580 loncom/interface/lonprintout.pm:1.581
--- loncom/interface/lonprintout.pm:1.580	Mon May 24 21:56:00 2010
+++ loncom/interface/lonprintout.pm	Thu Jun 10 16:14:34 2010
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.580 2010/05/24 21:56:00 raeburn Exp $
+# $Id: lonprintout.pm,v 1.581 2010/06/10 16:14:34 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2585,7 +2585,8 @@
 	     $resources_printed .= ":";
 	     $print_array[$i].=$output;
 	     $student_names[$i].=$person.':'.$fullname.'_END_';
-	     &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,&mt('last student').' '.$fullname);
+#	     &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,&mt('last student').' '.$fullname);
+	     &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student');
 	     $flag_latex_header_remove = 'YES';
 	     if (&Apache::loncommon::connection_aborted($r)) { last; }
 	 }
Index: loncom/interface/statistics/longradinganalysis.pm
diff -u loncom/interface/statistics/longradinganalysis.pm:1.9 loncom/interface/statistics/longradinganalysis.pm:1.10
--- loncom/interface/statistics/longradinganalysis.pm:1.9	Thu Oct 23 09:07:51 2008
+++ loncom/interface/statistics/longradinganalysis.pm	Thu Jun 10 16:14:39 2010
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: longradinganalysis.pm,v 1.9 2008/10/23 09:07:51 bisitz Exp $
+# $Id: longradinganalysis.pm,v 1.10 2010/06/10 16:14:39 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -176,7 +176,7 @@
 	}
 
 	&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
-                                                 &mt('last student'));
+                                                     'last student');
 
     }
 
Index: loncom/interface/statistics/lonproblemanalysis.pm
diff -u loncom/interface/statistics/lonproblemanalysis.pm:1.138 loncom/interface/statistics/lonproblemanalysis.pm:1.139
--- loncom/interface/statistics/lonproblemanalysis.pm:1.138	Thu Jan 14 17:20:51 2010
+++ loncom/interface/statistics/lonproblemanalysis.pm	Thu Jun 10 16:14:39 2010
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonproblemanalysis.pm,v 1.138 2010/01/14 17:20:51 bisitz Exp $
+# $Id: lonproblemanalysis.pm,v 1.139 2010/06/10 16:14:39 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -663,7 +663,7 @@
         }
         $answers{$correct->{$sname.':'.$sdom}{'answer'}}++;
         &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
-                                                 &mt('last student'));
+                                                     'last student');
     }
     &Apache::lonstathelpers::write_analysis_cache();
     &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
Index: loncom/interface/statistics/lonstathelpers.pm
diff -u loncom/interface/statistics/lonstathelpers.pm:1.61 loncom/interface/statistics/lonstathelpers.pm:1.62
--- loncom/interface/statistics/lonstathelpers.pm:1.61	Sat Apr 17 22:48:56 2010
+++ loncom/interface/statistics/lonstathelpers.pm	Thu Jun 10 16:14:39 2010
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstathelpers.pm,v 1.61 2010/04/17 22:48:56 www Exp $
+# $Id: lonstathelpers.pm,v 1.62 2010/06/10 16:14:39 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -612,7 +612,7 @@
         my $answer = &Apache::lonstathelpers::get_student_answer
             ($resource,$sname,$sdom,$partid,$respid);
         &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
-                                                 &mt('last student'));
+                                                     'last student');
         $answers{$answer}++;
         $student->{'answer'} = $answer;
     }
Index: loncom/localize/localize/de.pm
diff -u loncom/localize/localize/de.pm:1.384 loncom/localize/localize/de.pm:1.385
--- loncom/localize/localize/de.pm:1.384	Tue May 25 16:52:07 2010
+++ loncom/localize/localize/de.pm	Thu Jun 10 16:14:43 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # German Localization Lexicon
 #
-# $Id: de.pm,v 1.384 2010/05/25 16:52:07 bisitz Exp $
+# $Id: de.pm,v 1.385 2010/06/10 16:14:43 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2586,9 +2586,6 @@
    'You must choose one or more choices to continue.'
 => 'Zum Fortfahren müssen Sie mindestens eine oder mehrere Auswahlen treffen.',
 
-   'last student'
-=> 'letzten Studierenden',
-
    'may be open from a different computer.'
 => 'könnte von einem anderen Computer aus geöffnet sein.',
 
@@ -4756,9 +4753,6 @@
    '[_1] is not an acceptable weight. Weight must be a positive number.'
 => '[_1] ist kein zulässiger Wert für die Gewichtung. Der Wert muss eine positive Zahl sein.',
 
-   '1 minute'
-=> '1 Minute',
-
    '<b>HTML allowed</b>: Discussion participants can use limited HTML in their postings.'
 => '<b>HTML zugelassen</b>: Diskussionsteilnehmer können in ihren Beiträgen eingeschränkten HTML-Befehlssatz verwenden.',
 
@@ -5174,17 +5168,14 @@
    'Records per Page:'
 => 'Suchergebnisse je Seite:',
 
-   '[_1] minutes'
-=> '[_1] Minuten',
-
-   '[_1] minutes, [_2] seconds'
-=> '[_1] Minuten, [_2] Sekunden',
-
    '[_1] with value [_2]'
 => '[_1] mit dem Wert [_2]',
 
-   '[_1] seconds'
-=> '[_1] seconds',
+   '[_1]/[_2]: [quant,_3,minute,minutes,] [quant,_4,second ,seconds ,]remaining ([quant,_5,second] for last student)'
+=> '[_1]/[_2]: [quant,_3,min,min,] [quant,_4,s ,s ,]Restzeit ([quant,_5,s,s] für letzte/n Studenten/in)',
+
+   '[_1]/[_2]: [quant,_3,minute,minutes,] [quant,_4,second ,seconds ,]remaining ([quant,_5,second] for last five students)'
+=> '[_1]/[_2]: [quant,_3,min,min,] [quant,_4,s ,s ,]Restzeit ([quant,_5,s,s] für die letzten fünf Studierenden)',
 
    'all resources in the course'
 => 'alle Ressourcen des Kurses',
Index: loncom/localize/localize/es.pm
diff -u loncom/localize/localize/es.pm:1.43 loncom/localize/localize/es.pm:1.44
--- loncom/localize/localize/es.pm:1.43	Mon May  3 10:53:21 2010
+++ loncom/localize/localize/es.pm	Thu Jun 10 16:14:44 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Spanish Localization Lexicon
 #
-# $Id: es.pm,v 1.43 2010/05/03 10:53:21 bisitz Exp $
+# $Id: es.pm,v 1.44 2010/06/10 16:14:44 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2475,9 +2475,6 @@
    'You must choose one or more choices to continue.'
 => 'Debería seleccionar uno o más opciones para continuar.',
 
-   'last student'
-=> 'último estudiante',
-
    'may be open from a different computer.'
 => 'puede que esté abierto en otro ordenador.',
 
@@ -2493,9 +2490,6 @@
    'seconds'
 => 'segundos',
 
-   'seconds for'
-=> 'segundos para',
-
 #SYNC Wed Oct 15 20:34:21 2003
 
    'Additional Recipients'
@@ -5196,18 +5190,9 @@
    'Records per Page:'
 => 'Registros por página:',
 
-   '[_1] minutes'
-=> '[_1] minutos',
-
-   '[_1] minutes, [_2] seconds'
-=> '[_1] minutos, [_2] segundos',
-
    '[_1] with value [_2]'
 => '[_1] con valor [_2]',
 
-   '[_1] seconds'
-=> '[_1] segundos',
-
    'all resources in the course'
 => 'todos los recursos en el curso',
 
Index: loncom/localize/localize/zh.pm
diff -u loncom/localize/localize/zh.pm:1.90 loncom/localize/localize/zh.pm:1.91
--- loncom/localize/localize/zh.pm:1.90	Mon May  3 10:53:21 2010
+++ loncom/localize/localize/zh.pm	Thu Jun 10 16:14:44 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Chinese Simplified Localization Lexicon
 #
-# $Id: zh.pm,v 1.90 2010/05/03 10:53:21 bisitz Exp $
+# $Id: zh.pm,v 1.91 2010/06/10 16:14:44 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2456,9 +2456,6 @@
    'You must choose one or more choices to continue.'
 => 'Zum Fortfahren müssen Sie mindestens eine oder mehrere Auswahlen treffen.',
 
-   'last student'
-=> 'letzten Studierenden',
-
    'may be open from a different computer.'
 => 'könnte von einem anderen Computer aus geöffnet sein.',
 
@@ -2474,9 +2471,6 @@
    'seconds'
 => 'Sekunden',
 
-   'seconds for'
-=> 'Sekunden für',
-
    'Additional Recipients'
 => '其他收件人',
 
@@ -5187,18 +5181,9 @@
    'Records per Page:'
 => '每页显示结果:',
 
-   '[_1] minutes'
-=> '[_1] 分',
-
-   '[_1] minutes, [_2] seconds'
-=> '[_1] 分, [_2] 秒',
-
    '[_1] with value [_2]'
 => '[_1] 与价值 [_2]',
 
-   '[_1] seconds'
-=> '[_1] 秒',
-
    'all resources in the course'
 => '课程中的所有资源',
 

--bisitz1276186485--