Another possibility (apart from all the other ideas here) would
be to use the
Date::Manip module, which can handle
(both parse and produce) dates in several different languages
(search in the documentation for "Language" to see the supported
ones). For example:
use strict;
use Date::Manip;
my $d=ParseDate("today");
foreach my $l (qw(English French Swedish German Spanish Italian)) {
Date_Init("Language=$l");
print "$l: ".UnixDate($d, "%F\n");
}
Which produces:
English: Wednesday, September 27, 2000
French: mercredi, septembre 27, 2000
Swedish: Onsdag, September 27, 2000
German: Mittwoch, September 27, 2000
Spanish: Miercoles, Septiembre 27, 2000
Italian: Mercoledi, Settembre 27, 2000
Note a few points:
- I did the ParseDate before changing the language
from English (the default), because otherwise I would have had
to change "today" to each language in turn.
- I couldn't find a way for it to change the format according
to each language's conventions, as mentioned by ar0n.
- If all you need are month names, Date::Manip may be overkill,
because it is a very big module. But if you need dates in general,
it might be worth a try.
--ZZamboni
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.