[LON-CAPA-cvs] cvs: loncom /auth lonauth.pm /interface loncommon.pm /localize lonlocal.pm /localize/localize de.pm doc/loncapafiles loncapafiles.lpml

www lon-capa-cvs@mail.lon-capa.org
Tue, 16 Sep 2003 19:23:48 -0000


www		Tue Sep 16 15:23:48 2003 EDT

  Added files:                 
    /loncom/localize/localize	de.pm 

  Modified files:              
    /doc/loncapafiles	loncapafiles.lpml 
    /loncom/auth	lonauth.pm 
    /loncom/interface	loncommon.pm 
    /loncom/localize	lonlocal.pm 
  Log:
  Continued work on localization.
  
  Translation files go into
  
  loncom/localize/localize
  
  as
  
  de.pm
  pt.pm
  
  etc. Rest should be automagic.
  
  
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.282 doc/loncapafiles/loncapafiles.lpml:1.283
--- doc/loncapafiles/loncapafiles.lpml:1.282	Tue Sep 16 11:23:43 2003
+++ doc/loncapafiles/loncapafiles.lpml	Tue Sep 16 15:23:47 2003
@@ -2,7 +2,7 @@
  "http://lpml.sourceforge.net/DTD/lpml.dtd">
 <!-- loncapafiles.lpml -->
 
-<!-- $Id: loncapafiles.lpml,v 1.282 2003/09/16 15:23:43 www Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.283 2003/09/16 19:23:47 www Exp $ -->
 
 <!--
 
@@ -379,6 +379,12 @@
 </directory>
 <directory dist='default'>
   <protectionlevel>modest_delete</protectionlevel>
+  <targetdir dist='default'>home/httpd/lib/perl/Apache/localize</targetdir>
+  <categoryname>server readonly</categoryname>
+  <description>location of LON-CAPA MakeText translation files</description>
+</directory>
+<directory dist='default'>
+  <protectionlevel>modest_delete</protectionlevel>
   <targetdir dist='default'>home/httpd/lib/perl/HTML</targetdir>
   <categoryname>server readonly</categoryname>
   <description>location of HTML specific perl module fixes and additions
@@ -2493,6 +2499,19 @@
 Localization class for Locale::Maketext
 </description>
 </file>
+<fileglob>
+<glob>*.pm</glob>
+<sourcedir>loncom/localize/localize/</sourcedir>
+<targetdir dist='default'>
+home/httpd/lib/perl/Apache/localize/</targetdir>
+<categoryname>static conf</categoryname>
+<description>
+Translation files.
+</description>
+<filenames>
+de.pm
+</filenames>
+</fileglob>
 <file>
 <source>loncom/interface/loncoursedata.pm</source>
 <target dist='default'>home/httpd/lib/perl/Apache/loncoursedata.pm</target>
Index: loncom/auth/lonauth.pm
diff -u loncom/auth/lonauth.pm:1.55 loncom/auth/lonauth.pm:1.56
--- loncom/auth/lonauth.pm:1.55	Thu Sep 11 16:54:11 2003
+++ loncom/auth/lonauth.pm	Tue Sep 16 15:23:47 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # User Authentication Module
 #
-# $Id: lonauth.pm,v 1.55 2003/09/11 20:54:11 www Exp $
+# $Id: lonauth.pm,v 1.56 2003/09/16 19:23:47 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -46,6 +46,7 @@
 use Apache::lonnet();
 use Apache::lonmenu();
 use Fcntl qw(:flock);
+use Apache::lonlocal;
 
 my %FORM;
 
@@ -269,6 +270,8 @@
 	&reroute($r);
 	return OK;
     }
+
+    &Apache::lonlocal::get_language_handle();
 
     my $buffer;
     $r->read($buffer,$r->header_in('Content-length'),0);
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.116 loncom/interface/loncommon.pm:1.117
--- loncom/interface/loncommon.pm:1.116	Thu Sep 11 18:37:54 2003
+++ loncom/interface/loncommon.pm	Tue Sep 16 15:23:47 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.116 2003/09/11 22:37:54 albertel Exp $
+# $Id: loncommon.pm,v 1.117 2003/09/16 19:23:47 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -68,6 +68,8 @@
 use Apache::Constants qw(:common :http :methods);
 use Apache::lonmsg();
 use Apache::lonmenu();
+use Apache::lonlocal;
+
 my $readit;
 
 =pod 
@@ -1631,6 +1633,18 @@
     return %languages;
 }
 
+sub preferred_languages {
+    my @languages=();
+    if ($ENV{'environment.languages'}) {
+	@languages=split(/\s*(\,|\;|\:)\s*/,$ENV{'environment.languages'});
+    }
+    if ($ENV{'course.'.$ENV{'request.course.id'}.'.languages'}) {
+	@languages=(@languages,split(/\s*(\,|\;|\:)\s*/,
+	         $ENV{'course.'.$ENV{'request.course.id'}.'.languages'}));
+    }
+    return (@languages,'en-US');
+}
+
 ###############################################################
 ##               Student Answer Attempts                     ##
 ###############################################################
@@ -2059,6 +2073,7 @@
 
 sub bodytag {
     my ($title,$function,$addentries,$bodyonly,$domain,$forcereg)=@_;
+    $title=&mt($title);
     unless ($function) {
 	$function='student';
         if ($ENV{'request.role'}=~/^(cc|in|ta|ep)/) {
Index: loncom/localize/lonlocal.pm
diff -u loncom/localize/lonlocal.pm:1.1 loncom/localize/lonlocal.pm:1.2
--- loncom/localize/lonlocal.pm:1.1	Tue Sep 16 11:23:43 2003
+++ loncom/localize/lonlocal.pm	Tue Sep 16 15:23:47 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Localization routines
 #
-# $Id: lonlocal.pm,v 1.1 2003/09/16 15:23:43 www Exp $
+# $Id: lonlocal.pm,v 1.2 2003/09/16 19:23:47 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -51,7 +51,7 @@
 # ========= Get a handle (do not invoke in vain, leave this to access handlers)
 
 sub get_language_handle {
-    $lh=Apache::localize->get_handle();
+    $lh=Apache::localize->get_handle(&Apache::loncommon::preferred_languages);
 }
 
 1;

Index: loncom/localize/localize/de.pm
+++ loncom/localize/localize/de.pm

package Apache::localize::de;
use base qw(Apache::localize);
%Lexicon=('_AUTO' => 1,
	  'Navigate Course Contents' => 'Inhaltsverzeichnis' );

1;