develooper Front page | perl.i18n | Postings from May 2006

Perl, setlocale and Apache

Thread Next
From:
Claude Paroz
Date:
May 13, 2006 14:03
Subject:
Perl, setlocale and Apache
Message ID:
1147554172.8147.21.camel@localhost.localdomain
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




Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About