perl-i18n

Perl, setlocale and Apache

2006-05-13 14:03:30
Hi,

I'm trying to localise some web pages written with Perl scripts.
Here is a sample script I'm using to test :

#!/usr/bin/perl
use CGI qw(:all);
use Locale::gettext;
use POSIX;

POSIX::setlocale(LC_MESSAGES, "fr");
textdomain "libc";

my $q = new CGI;
print $q->header;
print $q->start_html(-title=>"Admin Login");
print $q->p(gettext("write incomplete"));
print $q->end_html;

If I run the script in the command line (perl test.pl), I'm getting the
message in French ("write incomplete" -> "écriture incomplète").

When I run the same script through my local Apache server
(http://localhost/cgi-bin/test.pl), the message is always in English, as
if the setlocale command had no effect.

Is there a solution ?

Regards

Claude



<Prev in Thread] Current Thread [Next in Thread>