[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm lonnavmaps.pm
www
lon-capa-cvs@mail.lon-capa.org
Wed, 17 Sep 2003 18:15:54 -0000
www Wed Sep 17 14:15:54 2003 EDT
Modified files:
/loncom/interface loncommon.pm lonnavmaps.pm
Log:
Internationalization
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.119 loncom/interface/loncommon.pm:1.120
--- loncom/interface/loncommon.pm:1.119 Wed Sep 17 12:50:58 2003
+++ loncom/interface/loncommon.pm Wed Sep 17 14:15:54 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.119 2003/09/17 16:50:58 www Exp $
+# $Id: loncommon.pm,v 1.120 2003/09/17 18:15:54 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1663,6 +1663,10 @@
}
&Apache::lonnet::logthis('Lang: '.join(',',@genlanguages));
return @genlanguages;
+}
+
+sub current_language {
+ return (&preferred_languages)[0];
}
###############################################################
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.228 loncom/interface/lonnavmaps.pm:1.229
--- loncom/interface/lonnavmaps.pm:1.228 Wed Sep 17 13:30:41 2003
+++ loncom/interface/lonnavmaps.pm Wed Sep 17 14:15:54 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.228 2003/09/17 17:30:41 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.229 2003/09/17 18:15:54 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -46,6 +46,7 @@
use Apache::Constants qw(:common :http);
use Apache::loncommon();
use Apache::lonmenu();
+use Apache::lonlocal;
use POSIX qw (floor strftime);
use Data::Dumper; # for debugging, not always used
@@ -134,7 +135,7 @@
}
$r->print("<html><head>\n");
- $r->print("<title>Navigate Course Contents</title>");
+ $r->print("<title>".&mt('Navigate Course Contents')."</title>");
# ------------------------------------------------------------ Get query string
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['register']);
@@ -221,7 +222,7 @@
}
} else {
$r->print("<a href='navmaps?jumpToFirstHomework'>" .
- "Go To My First Homework Problem</a> ");
+ &mt("Go To My First Homework Problem")."</a> ");
}
my $suppressEmptySequences = 0;
@@ -236,13 +237,13 @@
$filterFunc = sub { my $res = shift;
return $res->completable() || $res->is_map();
};
- $r->print("<p><font size='+2'>Uncompleted Homework</font></p>");
+ $r->print("<p><font size='+2'>".&mt("Uncompleted Homework")."</font></p>");
$ENV{'form.filter'} = '';
$ENV{'form.condition'} = 1;
$resource_no_folder_link = 1;
} else {
$r->print("<a href='navmaps?showOnlyHomework'>" .
- "Show Only Uncompleted Homework</a> ");
+ &mt("Show Only Uncompleted Homework")."</a> ");
}
# renderer call
@@ -261,7 +262,7 @@
# user knows there was no error.
if ($renderArgs->{'counter'} == 0) {
if ($showOnlyHomework) {
- $r->print("<p><font size='+1'>All homework is currently completed.</font></p>");
+ $r->print("<p><font size='+1'>".&mt("All homework is currently completed").".</font></p>");
} else { # both jumpToFirstHomework and normal use the same: course must be empty
$r->print("<p><font size='+1'>This course is empty.</font></p>");
}
@@ -331,35 +332,35 @@
my $status = $res->status($part);
if ($status == $res->NETWORK_FAILURE) {
- return "Having technical difficulties; please check status later";
+ return &mt("Having technical difficulties; please check status later");
}
if ($status == $res->NOTHING_SET) {
- return "Not currently assigned.";
+ return &mt("Not currently assigned.");
}
if ($status == $res->OPEN_LATER) {
return "Open " . timeToHumanString($res->opendate($part));
}
if ($status == $res->OPEN) {
if ($res->duedate($part)) {
- return "Due " . timeToHumanString($res->duedate($part));
+ return &mt("Due")." " .timeToHumanString($res->duedate($part));
} else {
- return "Open, no due date";
+ return &mt("Open, no due date");
}
}
if ($status == $res->PAST_DUE_ANSWER_LATER) {
- return "Answer open " . timeToHumanString($res->answerdate($part));
+ return &mt("Answer open")." " . timeToHumanString($res->answerdate($part));
}
if ($status == $res->PAST_DUE_NO_ANSWER) {
- return "Was due " . timeToHumanString($res->duedate($part));
+ return &mt("Was due")." " . timeToHumanString($res->duedate($part));
}
if ($status == $res->ANSWER_OPEN) {
- return "Answer available";
+ return &mt("Answer available");
}
if ($status == $res->EXCUSED) {
- return "Excused by instructor";
+ return &mt("Excused by instructor");
}
if ($status == $res->ATTEMPTED) {
- return "Answer submitted, not yet graded.";
+ return &mt("Answer submitted, not yet graded");
}
if ($status == $res->TRIES_LEFT) {
my $tries = $res->tries($part);
@@ -372,14 +373,14 @@
}
}
if ($res->duedate()) {
- return "Due " . timeToHumanString($res->duedate($part)) .
+ return &mt("Due")." " . timeToHumanString($res->duedate($part)) .
" $triesString";
} else {
- return "No due date $triesString";
+ return &mt("No due date")." $triesString";
}
}
if ($status == $res->ANSWER_SUBMITTED) {
- return 'Answer submitted';
+ return &mt('Answer submitted');
}
}
@@ -429,9 +430,11 @@
my ($time) = @_;
# zero, '0' and blank are bad times
if (!$time) {
- return 'never';
+ return &mt('never');
}
-
+ unless (&Apache::loncommon::current_language()=~/^en/) {
+ return localtime($time);
+ }
my $now = time();
my @time = localtime($time);