All date/time output should be fully localized now.
t = icalproperty_get_dtstart(p);
if (t.is_date) {
+ struct tm d_tm;
+ char d_str[32];
+ memset(&d_tm, 0, sizeof d_tm);
+ d_tm.tm_year = t.year - 1900;
+ d_tm.tm_mon = t.month - 1;
+ d_tm.tm_mday = t.day;
+ wc_strftime(d_str, sizeof d_str, "%x", &d_tm);
wprintf("<TR><TD><B>");
wprintf(_("Date:"));
- wprintf("</B></TD><TD>"
- "%s %d, %d</TD></TR>",
- monthname(t.month - 1),
- t.day, t.year
- );
+ wprintf("</B></TD><TD>%s</TD></TR>", d_str);
}
else {
tt = icaltime_as_timet(t);
lprintf(9, "...done.\n");
/** Display the Accept/Decline buttons */
- wprintf("<TR><TD>How would you like to respond to this invitation?</td>"
- "<td><FONT SIZE=+1>"
+ wprintf("<tr><td>%s</td>"
+ "<td><font size=+1>"
"<a href=\"respond_to_request?msgnum=%ld&cal_partnum=%s&sc=Accept\">%s</a>"
" | "
"<a href=\"respond_to_request?msgnum=%ld&cal_partnum=%s&sc=Tentative\">%s</a>"
" | "
"<a href=\"respond_to_request?msgnum=%ld&cal_partnum=%s&sc=Decline\">%s</a>"
"</FONT></TD></TR>\n",
+ _("How would you like to respond to this invitation?"),
msgnum, cal_partnum, _("Accept"),
msgnum, cal_partnum, _("Tentative"),
msgnum, cal_partnum, _("Decline")
struct tm tm;
const int span = 10;
int all_day_event = 0;
+ time_t monthselect_time;
+ struct tm monthselect_tm;
+ char monthselect_str[32];
char calhourformat[16];
get_preference("calhourformat", calhourformat, sizeof calhourformat);
wprintf(_("Month: "));
wprintf("<SELECT NAME=\"%s_month\" SIZE=\"1\">\n", prefix);
for (i=0; i<=11; ++i) {
+ monthselect_time = 1137997451 + (i * 2592000);
+ localtime_r(&monthselect_time, &monthselect_tm);
+ wc_strftime(monthselect_str, sizeof monthselect_str, "%B", &monthselect_tm);
wprintf("<OPTION %s VALUE=\"%d\">%s</OPTION>\n",
((tm.tm_mon == i) ? "SELECTED" : ""),
i+1,
- monthname(i)
+ monthselect_str
);
}
wprintf("</SELECT>\n");
int daystart = 8;
int dayend = 17;
char daystart_str[16], dayend_str[16];
+ struct tm d_tm;
+ char d_str[128];
get_preference("calhourformat", calhourformat, sizeof calhourformat);
get_preference("daystart", daystart_str, sizeof daystart_str);
wprintf("</TD>");
/** Today's date */
- wprintf("<TD ALIGN=CENTER>");
- wprintf("<FONT SIZE=+2>%s</FONT><br />"
- "<FONT SIZE=+3>%d</FONT><br />"
- "<FONT SIZE=+2>%d</FONT><br />",
- monthname(month-1),
- day, year);
- wprintf("</TD>");
+ memset(&d_tm, 0, sizeof d_tm);
+ d_tm.tm_year = year - 1900;
+ d_tm.tm_mon = month - 1;
+ d_tm.tm_mday = day;
+ wc_strftime(d_str, sizeof d_str,
+ "<td align=center>"
+ "<font size=+2>%B</font><br />"
+ "<font size=+3>%d</font><br />"
+ "<font size=+2>%Y</font><br />"
+ "</td>",
+ &d_tm
+ );
+ wprintf("%s", d_str);
/** Right arrow */
wprintf("<TD ALIGN=CENTER>");
}
}
-/**
- * \brief Convenience function to return a month name
- *
- * \param m Numeric month
- */
-char *monthname(int m)
-{
- static char months[12][32];
- static int initialized = 0;
-
- time_t tt;
- struct tm tm;
- int i;
-
- if (!initialized) {
- for (i=0; i<12; ++i) {
- tt = 1137997451 + (i * 2592000);
- localtime_r(&tt, &tm);
- wc_strftime(months[i], 32, "%B", &tm);
- lprintf(9, "%s\n", months[i]);
- }
- }
- initialized = 1;
-
- return months[m];
-
-}
-
-
/**
* \brief Format TIME ONLY for output
size_t wc_strftime(char *s, size_t max, const char *format, const struct tm *tm);
void fmt_date(char *buf, time_t thetime, int brief);
void fmt_time(char *buf, time_t thetime);
-char *monthname(int m);
void httpdate(char *buf, time_t thetime);
time_t httpdate_to_timestamp(char *buf);
void end_webcit_session(void);