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

bisitz bisitz at source.lon-capa.org
Tue Aug 13 13:38:24 EDT 2013


bisitz		Tue Aug 13 17:38:24 2013 EDT

  Modified files:              
    /loncom/interface	portfolio.pm 
    /loncom/localize/localize	de.pm 
  Log:
  - Improve Internationalization:
      - Optimized inclusion of dynamic content to allow proper translation
      - Consistent wording
      - Use quant for conditions
      - Updated related German translation file entries
  - XHTML (javascript inclusion)
  - filename style for filenames
  - Coding style: Early escape for "Add new..." loop if no additions are requested
  
  
  
-------------- next part --------------
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.248 loncom/interface/portfolio.pm:1.249
--- loncom/interface/portfolio.pm:1.248	Mon Jul 15 14:32:44 2013
+++ loncom/interface/portfolio.pm	Tue Aug 13 17:38:19 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # portfolio browser
 #
-# $Id: portfolio.pm,v 1.248 2013/07/15 14:32:44 bisitz Exp $
+# $Id: portfolio.pm,v 1.249 2013/08/13 17:38:19 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1179,24 +1179,29 @@
         my $now = time;
         my $then = $now + (60*60*24*180); # six months approx.
         &open_form($r,$url);
-        my %showtypes = &Apache::lonlocal::texthash (
+        my %showtypes = (
            course  => 'course/community',
            domains => 'domain',
            users   => 'user',
         );
         foreach my $newitem (@types) {
-            if ($env{'form.new'.$newitem} > 0) {
-                $r->print('<br />'.&mt('Add new [_1]-based[_2] access control for portfolio file: [_3]','<b>'.$showtypes{$newitem},'</b>','<b>'.$env{'form.currentpath'}.$env{'form.selectfile'}.'</b>').'<br /><br />');
-                $firstitem = $totalnew;
-                $lastitem = $totalnew + $env{'form.new'.$newitem};
-                $totalnew = $lastitem;
-                my @numbers;   
-                for (my $i=$firstitem; $i<$lastitem; $i++) {
-                    push(@numbers,$i);
-                }
-                &display_access_row($r,$status,$newitem,\@numbers,
-                                    $access_controls{$file_name},$now,$then);
+            next if ($env{'form.new'.$newitem} <= 0);
+            $r->print(
+                '<p>'
+               .&mt('Add new [_1]'.$showtypes{$newitem}.'-based[_2] access control for portfolio file: [_3]',
+                    '<b>','</b>',
+                    '<span class="LC_filename"><b>'
+                   .$env{'form.currentpath'}.$env{'form.selectfile'}.'</b></span>')
+               .'</p>');
+            $firstitem = $totalnew;
+            $lastitem = $totalnew + $env{'form.new'.$newitem};
+            $totalnew = $lastitem;
+            my @numbers;   
+            for (my $i=$firstitem; $i<$lastitem; $i++) {
+                push(@numbers,$i);
             }
+            &display_access_row($r,$status,$newitem,\@numbers,
+                                $access_controls{$file_name},$now,$then);
         }
         &close_form($r,$url);
     } else {
@@ -1465,19 +1470,14 @@
 
 sub access_element {
     my ($r,$type,$acl_count,$items,$access_controls,$now,$then) = @_;
-    my %typetext = &Apache::lonlocal::texthash(
+    my %typetext = (
         domains => 'Domain',
         users   => 'User',
         course  => 'Course/Community'
     );
-    $r->print('<h3>'.&mt('[_1]-based conditional access: ',$typetext{$type}));
+    $r->print('<h3>'.&mt($typetext{$type}.'-based conditional access:').' ');
     if ($$acl_count{$type}) {
-        $r->print($$acl_count{$type}.' ');
-        if ($$acl_count{$type} > 1) {
-            $r->print(&mt('conditions'));
-        } else {
-            $r->print(&mt('condition'));
-        }
+        $r->print(&mt('[quant,_1,condition]',$$acl_count{$type}));
     } else {
         $r->print(&mt('Off'));
     }
@@ -1488,13 +1488,16 @@
 
 sub display_access_row {
     my ($r,$status,$type,$items,$access_controls,$now,$then) = @_;
-    my $showtype;
+    my ($showtype, $infotype);
     if ($type eq 'course') {
         $showtype = &mt('Courses/Communities');
+        $infotype = 'Course/Community';
     } elsif ($type eq 'domains') {
         $showtype = &mt('Domains');
+        $infotype = 'Domain';
     } elsif ($type eq 'users') {
         $showtype = &mt('Users');
+        $infotype = 'User';
     }
     if (@{$items} > 0) {
         my @all_doms;
@@ -1532,8 +1535,12 @@
         }
         $r->print(&Apache::loncommon::end_data_table());
     } else {
-        $r->print(&mt('No [_1]-based conditions defined.',$showtype).'<br />'.
-                  &additional_item($type));
+        $r->print(
+            '<p class="LC_info">'
+           .&mt('No '.$infotype.'-based conditions defined')
+           .'</p>'
+           .&additional_item($type)
+        );
     }
     return;
 }
@@ -1541,6 +1548,7 @@
 sub course_js {
     return qq|
 <script type="text/javascript">
+// <![CDATA[
 function setRoleOptions(num,roleid,cdom,cnum,type) {
     updateIndexNum = getIndexByValue('update',num);
     var addItem = 'add_role_'+num;
@@ -1580,6 +1588,7 @@
     return -1;
 }
 
+// ]]>
 </script>
 |;
 }
@@ -1697,14 +1706,16 @@
     my ($type) = @_;
     my $showtype;
     if ($type eq 'course') {
-        $showtype = &mt('course/community');
+        $showtype = 'course/community';
     } elsif ($type eq 'domains') {
-        $showtype = &mt('domains');
+        $showtype = 'domain';
     } elsif ($type eq 'users') {
-        $showtype = &mt('users');
+        $showtype = 'user';
     }
-    my $output = &mt('Add new [_1] condition(s)?',$showtype).' '.&mt('Number to add: ').'<input type="text" name="new'.$type.'" size="3" value="0" />';
-    return $output;
+    return
+        &mt('Add new '.$showtype.'-based condition(s)?')
+       .' '.&mt('Number to add: ')
+       .'<input type="text" name="new'.$type.'" size="3" value="0" />';
 }
 
 sub actionbox {
Index: loncom/localize/localize/de.pm
diff -u loncom/localize/localize/de.pm:1.520 loncom/localize/localize/de.pm:1.521
--- loncom/localize/localize/de.pm:1.520	Tue Aug 13 14:11:56 2013
+++ loncom/localize/localize/de.pm	Tue Aug 13 17:38:23 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # German Localization Lexicon
 #
-# $Id: de.pm,v 1.520 2013/08/13 14:11:56 bisitz Exp $
+# $Id: de.pm,v 1.521 2013/08/13 17:38:23 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -14260,14 +14260,17 @@
    'based on domain, username, or course/community affiliation.'
 => 'basierend auf Domäne, Benutzerkennung oder Kurs-/Community-Zugehörigkeit',
 
-   '[_1]-based conditional access: '
-=> '[_1]-basierter bedingungsabhängiger Zugriff: ',
+   'Domain-based conditional access:'
+=> 'Domänen-basierter bedingungsabhängiger Zugriff:',
 
-   'conditions'
-=> 'Bedingungen',
+   'User-based conditional access:'
+=> 'Benutzer-basierter bedingungsabhängiger Zugriff:',
 
-   'condition'
-=> 'Bedingung',
+   'Course/Community-based conditional access:'
+=> 'Kurs-/Community-basierter bedingungsabhängiger Zugriff:',
+
+   '[quant,_1,condition]'
+=> '[quant,_1,Bedingung,Bedingungen]',
 
    'Action?'
 => 'Aktion?',
@@ -14275,8 +14278,14 @@
    'Allowed course/community affiliations'
 => 'Zugelassene Kurs-/Community-Mitgliedszugehörigkeiten', # ???
 
-   'No [_1]-based conditions defined.'
-=> 'Keine [_1]-basierten Bedingungen definiert.',
+   'No Domain-based conditions defined'
+=> 'Keine Domänen-basierten Bedingungen definiert',
+
+   'No User-based conditions defined'
+=> 'Keine Benutzer-basierten Bedingungen definiert',
+
+   'No Course/Community-based conditions defined'
+=> 'Keine Kurs-/Community-basierten Bedingungen definiert',
 
    'Type of change'
 => 'Änderungsart',
@@ -14398,8 +14407,14 @@
    'Existing control(s) modified'
 => 'Bestehende Zugriffskontrolle(n) geändert',
 
-   'Add new [_1]-based[_2] access control for portfolio file: [_3]'
-=> 'Neue [_1]-basierte[_2] Zugriffskontrolle für Portfolio-Dateien hinzufügen: [_3]',
+   'Add new [_1]course/community-based[_2] access control for portfolio file: [_3]'
+=> 'Neue [_1]kurs-/community-basierte[_2] Zugriffskontrolle für Portfolio-Datei [_3] hinzufügen',
+
+   'Add new [_1]domain-based[_2] access control for portfolio file: [_3]'
+=> 'Neue [_1]domänen-basierte[_2] Zugriffskontrolle für Portfolio-Datei [_3] hinzufügen',
+
+   'Add new [_1]user-based[_2] access control for portfolio file: [_3]'
+=> 'Neue [_1]benutzer-basierte[_2] Zugriffskontrolle für Portfolio-Datei [_3] hinzufügen',
 
    'Display all access settings for this file'
 => 'Alle Einstellungen für diese Datei anzeigen',
@@ -14413,8 +14428,14 @@
    "Format for users' username:domain information:"
 => "Format für Informationen des Benutzers username:domäne:", # ??? -> portfolio.pm
 
-   'Add new [_1] condition(s)?'
-=> 'Neue [_1]-Bedingung(en) hinzufügen?',
+   'Add new course/community-based condition(s)?'
+=> 'Neue kurs-/community-basierte(n) Bedingung(en) hinzufügen?',
+
+   'Add new domain-based condition(s)?'
+=> 'Neue domänen-basierte(n) Bedingung(en) hinzufügen?',
+
+   'Add new user-based condition(s)?'
+=> 'Neue benutzer-basierte(n) Bedingung(en) hinzufügen?',
 
    'Number to add: '
 => 'Anzahl: ', # 'Anzahl neu Hinzuzufügender: ',


More information about the LON-CAPA-cvs mailing list