version 1.24, 2003/10/11 14:06:01
|
version 1.26, 2003/11/07 23:22:22
|
Line 171 require Exporter;
|
Line 171 require Exporter;
|
our @ISA = qw (Exporter); |
our @ISA = qw (Exporter); |
our @EXPORT = qw(mt mtn ns); |
our @EXPORT = qw(mt mtn ns); |
|
|
my $reroute; |
|
|
|
# ========================================================= The language handle |
# ========================================================= The language handle |
|
|
use vars qw($lh); |
use vars qw($lh); |
Line 181 use vars qw($lh);
|
Line 179 use vars qw($lh);
|
|
|
sub mt (@) { |
sub mt (@) { |
# my $fh=Apache::File->new('>>/home/www/loncapa/loncom/localize/localize/newphrases.txt'); |
# my $fh=Apache::File->new('>>/home/www/loncapa/loncom/localize/localize/newphrases.txt'); |
# print $fh join('',@_)."\n"; |
# print $fh @_[0]."\n"; |
# $fh->close(); |
# $fh->close(); |
unless ($ENV{'environment.translator'}) { |
if ($lh) { |
if ($lh) { |
return $lh->maketext(@_); |
return $lh->maketext(@_); |
|
} else { |
|
return @_; |
|
} |
|
} else { |
} else { |
if ($lh) { |
return @_; |
my $trans=$lh->maketext(@_); |
|
my $link='<a target="trans" href="/cgi-bin/translator.pl?arg1='. |
|
&Apache::lonnet::escape($_[0]).'&arg2='. |
|
&Apache::lonnet::escape($_[1]).'&arg3='. |
|
&Apache::lonnet::escape($_[2]).'&lang='. |
|
$ENV{'environment.translator'}. |
|
'">[['.$trans.']]</a>'; |
|
if ($ENV{'transreroute'}) { |
|
$reroute.=$link; |
|
return $trans; |
|
} else { |
|
return $link; |
|
} |
|
} else { |
|
return @_; |
|
} |
|
} |
} |
} |
} |
|
|
# ================================================================ The <mt> tag |
|
|
|
BEGIN { |
|
} |
|
|
|
sub start_mt { |
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
|
return &mt(&Apache::lonxml::get_all_text("/mt",$parser)); |
|
} |
|
|
|
sub end_mt { |
|
return ''; |
|
} |
|
|
|
# ============================================================== What language? |
# ============================================================== What language? |
|
|
sub current_language { |
sub current_language { |
Line 266 sub texthash {
|
Line 230 sub texthash {
|
} |
} |
return %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 ''; |
|
} |
|
} |
|
|
|
# ========= Get a handle (do not invoke in vain, leave this to access handlers) |
# ========= Get a handle (do not invoke in vain, leave this to access handlers) |
|
|
Line 297 sub get_language_handle {
|
Line 239 sub get_language_handle {
|
if (&Apache::lonnet::mod_perl_version == 1) { |
if (&Apache::lonnet::mod_perl_version == 1) { |
$r->content_languages([¤t_language()]); |
$r->content_languages([¤t_language()]); |
} |
} |
&Apache::lonxml::register('Apache::lonlocal',('mt')); |
|
### setlocale(LC_ALL,¤t_locale); |
### setlocale(LC_ALL,¤t_locale); |
} |
} |
|
|