2007-05-05 12:05:41 UTC by mbaehr
- Pike/7.7/lib/modules/Calendar.pmod/YMD.pike (+3/-5)
don't hardcode month and day names here
changes format_http() from using constant English strings to using Calendar's language bound day and month names. I don't contest that that format could be useful for some purposes, but shouldn't it use a different method name then? RFC 2616 states that a HTTP-date is:
HTTP-date = rfc1123-date | rfc850-date | asctime-date rfc1123-date = wkday "," SP date1 SP time SP "GMT" rfc850-date = weekday "," SP date2 SP time SP "GMT" asctime-date = wkday SP date3 SP time SP 4DIGIT date1 = 2DIGIT SP month SP 4DIGIT ; day month year (e.g., 02 Jun 1982) date2 = 2DIGIT "-" month "-" 2DIGIT ; day-month-year (e.g., 02-Jun-82) date3 = month SP ( 2DIGIT | ( SP 1DIGIT )) ; month day (e.g., Jun 2) time = 2DIGIT ":" 2DIGIT ":" 2DIGIT ; 00:00:00 - 23:59:59 wkday = "Mon" | "Tue" | "Wed" | "Thu" | "Fri" | "Sat" | "Sun" weekday = "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday" month = "Jan" | "Feb" | "Mar" | "Apr" | "May" | "Jun" | "Jul" | "Aug" | "Sep" | "Oct" | "Nov" | "Dec"
Examples of Calendar's less known features (swedish and roman latin):
Calendar.set_language("swedish")->Day()->week_day_shortname()
"sön"
Calendar.set_language("roman")->Day()->month_shortname();
"Mai"
I'm not sure if the Calendar module tries to do any environment sniffing of its own to pick up a suitable language, but it's been known to be a bit over-customizable by .h files, so I'd be wary of changes like these.