version 1.38, 2006/04/07 22:03:55
|
version 1.41, 2006/08/28 14:26:25
|
Line 163 package Apache::lonlocal;
|
Line 163 package Apache::lonlocal;
|
use strict; |
use strict; |
use Apache::localize; |
use Apache::localize; |
use locale; |
use locale; |
use POSIX qw(locale_h); |
use POSIX qw(locale_h strftime); |
|
|
require Exporter; |
require Exporter; |
|
|
Line 258 sub get_language_handle {
|
Line 258 sub get_language_handle {
|
|
|
# ========================================================== Localize localtime |
# ========================================================== Localize localtime |
sub gettimezone { |
sub gettimezone { |
return ' ('.$Apache::lonnet::env{'server.timezone'}.')'; |
my ($time) = @_; |
|
return ' ('.&strftime("%Z",localtime($time)).')'; |
} |
} |
|
|
sub locallocaltime { |
sub locallocaltime { |
my $thistime=shift; |
my $thistime=shift; |
|
if (!defined($thistime) || $thistime eq '') { |
|
return &mt('Never'); |
|
} |
if ((¤t_language=~/^en/) || (!$lh)) { |
if ((¤t_language=~/^en/) || (!$lh)) { |
return ''.localtime($thistime).&gettimezone(); |
return ''.localtime($thistime).&gettimezone($thistime); |
} else { |
} else { |
my $format=$lh->maketext('date_locale'); |
my $format=$lh->maketext('date_locale'); |
if ($format eq 'date_locale') { |
if ($format eq 'date_locale') { |
Line 294 sub locallocaltime {
|
Line 298 sub locallocaltime {
|
'month','weekday','ampm') { |
'month','weekday','ampm') { |
$format=~s/\$$_/eval('$'.$_)/gse; |
$format=~s/\$$_/eval('$'.$_)/gse; |
} |
} |
return $format.&gettimezone(); |
return $format.&gettimezone($thistime); |
} |
} |
} |
} |
|
|
Line 341 sub transstatic {
|
Line 345 sub transstatic {
|
$$strptr=~s/MT\{([^\}]*)\}/&mt($1)/gse; |
$$strptr=~s/MT\{([^\}]*)\}/&mt($1)/gse; |
} |
} |
|
|
|
=pod |
|
|
|
=item * mt_escape |
|
|
|
mt_escape takes a string reference and escape the [] in there so mt |
|
will leave them as is and not try to expand them |
|
|
|
=cut |
|
|
|
sub mt_escape { |
|
my ($str_ref) = @_; |
|
$$str_ref =~s/~/~~/g; |
|
$$str_ref =~s/([\[\]])/~$1/g; |
|
} |
|
|
1; |
1; |
|
|
__END__ |
__END__ |