--- loncom/localize/lonlocal.pm 2003/09/16 22:40:25 1.3 +++ loncom/localize/lonlocal.pm 2003/09/20 13:21:45 1.6 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Localization routines # -# $Id: lonlocal.pm,v 1.3 2003/09/16 22:40:25 www Exp $ +# $Id: lonlocal.pm,v 1.6 2003/09/20 13:21:45 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -39,6 +39,8 @@ require Exporter; our @ISA = qw (Exporter); our @EXPORT = qw(mt); +my $reroute; + # ========================================================= The language handle use vars qw($lh); @@ -49,12 +51,57 @@ sub mt (@) { unless ($ENV{'environment.translator'}) { return $lh->maketext(@_); } else { - return ''.$lh->maketext(@_).''; + '">[['.$trans.']]'; + if ($ENV{'transreroute'}) { + $reroute.=$link; + return $trans; + } else { + return $link; + } + } +} + +# ============================================================== What language? + +sub current_language { + return $lh->language_tag(); +} + +# ============================================================== Translate hash + +sub texthash { + my %hash=@_; + foreach (keys %hash) { + $hash{$_}=&mt($hash{$_}); + } + return %hash; +} +# ======================================================== Re-route translation + +sub clearreroutetrans { + &reroutetrans(); + $reroute=''; +} + +# ======================================================== Re-route translation + +sub reroutetrans { + $ENV{'transreroute'}=1; +} + +# ==================================================== End re-route translation +sub endreroutetrans { + $ENV{'transreroute'}=0; + if ($ENV{'environment.translator'}) { + return $reroute; + } else { + return ''; } } @@ -62,6 +109,7 @@ sub mt (@) { sub get_language_handle { $lh=Apache::localize->get_handle(&Apache::loncommon::preferred_languages); +# &Apache::lonnet::logthis($lh->encoding().' - '.$lh->language_tag()); } 1;