[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm /localize lonlocal.pm

www lon-capa-cvs@mail.lon-capa.org
Mon, 22 Dec 2003 22:39:07 -0000


www		Mon Dec 22 17:39:07 2003 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
    /loncom/localize	lonlocal.pm 
  Log:
  Saving my work on trying to get the languages right after re-init, etc.
  Currently totally dysfunctional.
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.160 loncom/interface/loncommon.pm:1.161
--- loncom/interface/loncommon.pm:1.160	Wed Dec 17 14:20:23 2003
+++ loncom/interface/loncommon.pm	Mon Dec 22 17:39:07 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.160 2003/12/17 19:20:23 matthew Exp $
+# $Id: loncommon.pm,v 1.161 2003/12/22 22:39:07 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1617,10 +1617,6 @@
     if ($ENV{'course.'.$ENV{'request.course.id'}.'.languages'}) {
 	@languages=(@languages,split(/\s*(\,|\;|\:)\s*/,
 	         $ENV{'course.'.$ENV{'request.course.id'}.'.languages'}));
-    }
-    my $browser=(split(/\;/,$ENV{'HTTP_ACCEPT_LANGUAGE'}))[0];
-    if ($browser) {
-	@languages=(@languages,split(/\s*(\,|\;|\:)\s*/,$browser));
     }
     if ($Apache::lonnet::domain_lang_def{$ENV{'user.domain'}}) {
 	@languages=(@languages,
Index: loncom/localize/lonlocal.pm
diff -u loncom/localize/lonlocal.pm:1.27 loncom/localize/lonlocal.pm:1.28
--- loncom/localize/lonlocal.pm:1.27	Tue Dec  9 19:32:56 2003
+++ loncom/localize/lonlocal.pm	Mon Dec 22 17:39:07 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Localization routines
 #
-# $Id: lonlocal.pm,v 1.27 2003/12/10 00:32:56 www Exp $
+# $Id: lonlocal.pm,v 1.28 2003/12/22 22:39:07 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -236,7 +236,14 @@
 
 sub get_language_handle {
     my $r=shift;
-    $lh=Apache::localize->get_handle(&Apache::loncommon::preferred_languages);
+    my $languages=&Apache::loncommon::preferred_languages;
+    unless ($languages) {
+	my $headers=$r->headers_in;
+	$ENV{'HTTP_ACCEPT_LANGUAGE'}=$headers->{'Accept-language'};
+    } else {
+	$ENV{'HTTP_ACCEPT_LANGUAGE'}='';
+    }
+    $lh=Apache::localize->get_handle($languages);
     if (&Apache::lonnet::mod_perl_version == 1) {
 	$r->content_languages([&current_language()]);
     }