On Thu, 2 Jul 2009, Vaclav Barta wrote:

I'm using DateTime to generate calendars on my web page (e.g.
http://www.mangrove.cz/calendar/vb ), which is localized to Czech and English
(change your browser preferences if you want to see the two languages). The
heading of the calendar is currently taken from DateTime::month_name, but is
wrong in Czech, where nouns are inflected and the month name must be in the
nominative case when used by itself, while what DateTime::month_name returns
is the case used when month name goes after day number (don't know its latin
name, sorry :-) ). In other words, the example in the synopsis of
DateTime::Locale works in French (and English) but not in Czech (and probably
other languages).

I've looked at CLDR, and it seems it actually facilitates this distinction
between "stand-alone" and "format" contexts (and the data is there in cs_CZ),
but the DateTime interface AFAIK doesn't. As a workaround, I suppose I can
define my own month names, but I think DateTime should be extended - perhaps
a parameter to month_name and day_name?

You can get this information directly from DateTime::Locale itself:

 my $cs = DateTime::Locale->load('cs_CZ');

 print "$_\n" for @{ $cs->month_stand_alone_wide() };

Given that the stand-alone names are much less used, _and_ that they're typically used for things like calendars, where you need to loop over them anyway, I don't think it'd be that helpful to add an API to DateTime.pm itself for them.


-dave

/*============================================================
http://VegGuide.org               http://blog.urth.org
Your guide to all that's veg      House Absolute(ly Pointless)
============================================================*/

Reply via email to