[Perl] Multilingual date
shlomo at siftology.com
Wed Feb 13 08:32:31 PST 2002
"Reuven M. Lerner" wrote:
> >>>>> Shlomo Yona writes:
> Shlomo> How can set up my locales from Perl (rather than counting on
> Shlomo> them to be set in the environment)?
> Use the POSIX "setlocale" subroutine, whose first argument indicates
> which part of the locale you want to set:
> my @locales = qw(cs_CZ fr_FR de_DE);
> use POSIX qw(LC_ALL setlocale strftime);
> foreach my $locale (@locales)
> setlocale(LC_ALL, $locale);
> $now_string = strftime "%a %b %e %H:%M:%S %Y", localtime;
> print "Locale '$locale': '$now_string'\n";
The only missing thing is the formatting for strftime, it does not
change with the locale - I mean, the way date is presented in English is
not the same way to do it in Hebrew.
Can you suggets a way to read the proper formatting accirding to the
locale as well?
Siftology Ltd. Israel.
Shlomo.Yona at Siftology.com
More information about the Perl