[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm /localize/localize de.pm pt.pm
www
lon-capa-cvs@mail.lon-capa.org
Wed, 17 Sep 2003 14:30:13 -0000
www Wed Sep 17 10:30:13 2003 EDT
Modified files:
/loncom/interface loncommon.pm
/loncom/localize/localize de.pm pt.pm
Log:
Takes cascading language preferences
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.117 loncom/interface/loncommon.pm:1.118
--- loncom/interface/loncommon.pm:1.117 Tue Sep 16 15:23:47 2003
+++ loncom/interface/loncommon.pm Wed Sep 17 10:30:13 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.117 2003/09/16 19:23:47 www Exp $
+# $Id: loncommon.pm,v 1.118 2003/09/17 14:30:13 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1613,16 +1613,8 @@
sub display_languages {
my %languages=();
- if ($ENV{'environment.languages'}) {
- foreach (split(/\s*(\,|\;|\:)\s*/,$ENV{'environment.languages'})) {
- $languages{$_}=1;
- }
- }
- if ($ENV{'course.'.$ENV{'request.course.id'}.'.languages'}) {
- foreach (split(/\s*(\,|\;|\:)\s*/,
- $ENV{'course.'.$ENV{'request.course.id'}.'.languages'})) {
- $languages{$_}=1;
- }
+ foreach (&preferred_languages()) {
+ $languages{$_}=1;
}
&get_unprocessed_cgi($ENV{'QUERY_STRING'},['displaylanguage']);
if ($ENV{'form.displaylanguage'}) {
@@ -1642,7 +1634,35 @@
@languages=(@languages,split(/\s*(\,|\;|\:)\s*/,
$ENV{'course.'.$ENV{'request.course.id'}.'.languages'}));
}
- return (@languages,'en-US');
+ 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,
+ $Apache::lonnet::domain_lang_def{$ENV{'user.domain'}});
+ }
+ if ($Apache::lonnet::domain_lang_def{$ENV{'request.role.domain'}}) {
+ @languages=(@languages,
+ $Apache::lonnet::domain_lang_def{$ENV{'request.role.domain'}});
+ }
+ if ($Apache::lonnet::domain_lang_def{
+ $Apache::lonnet::perlvar{'lonDefDomain'}}) {
+ @languages=(@languages,
+ $Apache::lonnet::domain_lang_def{
+ $Apache::lonnet::perlvar{'lonDefDomain'}});
+ }
+# turn "en-ca" into "en-ca,en"
+ my @genlanguages;
+ foreach (@languages) {
+ unless ($_=~/\w/) { next; }
+ push (@genlanguages,$_);
+ if ($_=~/(\-|\_)/) {
+ push (@genlanguages,(split(/(\-|\_)/,$_))[0]);
+ }
+ }
+ &Apache::lonnet::logthis('Lang: '.join(',',@genlanguages));
+ return @genlanguages;
}
###############################################################
Index: loncom/localize/localize/de.pm
diff -u loncom/localize/localize/de.pm:1.4 loncom/localize/localize/de.pm:1.5
--- loncom/localize/localize/de.pm:1.4 Wed Sep 17 09:47:55 2003
+++ loncom/localize/localize/de.pm Wed Sep 17 10:30:13 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# German Localization Lexicon
#
-# $Id: de.pm,v 1.4 2003/09/17 13:47:55 www Exp $
+# $Id: de.pm,v 1.5 2003/09/17 14:30:13 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -37,22 +37,22 @@
=> 'Domäne',
'Load'
-=> 'Last'
+=> 'Last',
'User Load'
-=> 'Nutzerlast'
+=> 'Nutzerlast',
'Help'
-=> 'Hilfe'
+=> 'Hilfe',
'Log in'
-=> 'Einloggen'
+=> 'Einloggen',
'Username'
-=> 'Benutzername'
+=> 'Benutzername',
'Password'
-=> 'Passwort'
+=> 'Passwort',
'choose'
=> 'waehle',
Index: loncom/localize/localize/pt.pm
diff -u loncom/localize/localize/pt.pm:1.1 loncom/localize/localize/pt.pm:1.2
--- loncom/localize/localize/pt.pm:1.1 Wed Sep 17 09:47:55 2003
+++ loncom/localize/localize/pt.pm Wed Sep 17 10:30:13 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Portuguese Localization Lexicon
#
-# $Id: pt.pm,v 1.1 2003/09/17 13:47:55 www Exp $
+# $Id: pt.pm,v 1.2 2003/09/17 14:30:13 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -29,7 +29,7 @@
######################################################################
-package Apache::localize::de;
+package Apache::localize::pt;
use base qw(Apache::localize);
%Lexicon=('_AUTO' => 1,
'Server'
@@ -39,16 +39,16 @@
=> 'Dominio',
'Load'
-=> 'Carga'
+=> 'Carga',
'User Load'
-=> 'Carga de Usuarios'
+=> 'Carga de Usuarios',
'System Administration'
-=> 'Administrador do Sistema'
+=> 'Administrador do Sistema',
'Server Administration'
-=> 'Administrador do Servidor'
+=> 'Administrador do Servidor',
'aboutlon.gif'
=> 'aboutlon_pt.gif',
@@ -60,13 +60,13 @@
=> 'userauthentication_pt.gif',
'Help'
-=> 'Ajuda'
+=> 'Ajuda',
'Log in'
-=> 'Entrar'
+=> 'Entrar',
'Username'
-=> 'Usuario'
+=> 'Usuario',
'Password'
=> 'Senha'