difftime=(event_tte-event_tts)/60;
hours=(int)(difftime / 60);
minutes=difftime % 60;
- wprintf("<tr><td bgcolor='%s'>%i:%i</td><td bgcolor='%s'>"
+ wprintf("<tr><td bgcolor='%s'>%i:%2i</td><td bgcolor='%s'>"
"<font size=-1>"
"<a href=\"display_edit_event?msgnum=%ld&calview=%s&year=%s&month=%s&day=%s\">",
daycolor,
escputs((char *)
icalproperty_get_comment(p));
/** \todo: allso ammitime format */
- strftime(&sbuf[0],sizeof(sbuf),timeformat,&event_tms);
- strftime(&ebuf[0],sizeof(sbuf),timeformat,&event_tme);
+ strftime_l(&sbuf[0], sizeof(sbuf), timeformat, &event_tms,
+ wc_locales[WC->selected_language]);
+ strftime_l(&ebuf[0], sizeof(sbuf), timeformat, &event_tme,
+ wc_locales[WC->selected_language]);
wprintf("</a></font></td>"
"<td bgcolor='%s'>%s</td><td bgcolor='%s'>%s</td></tr>",
/** Before displaying Sunday, start a new CELL */
if ((i % 7) == 0) {
- strftime(&weeknumber[0],sizeof(weeknumber),"%U",&tm);
+ strftime_l(&weeknumber[0], sizeof(weeknumber), "%U", &tm, wc_locales[WC->selected_language]);
wprintf("<TABLE border='0' BGCOLOR=\"#EEEECC\" width='100%'> <tr><th colspan='4'>%s %s</th></tr>"
" <tr><td>%s</td><td width='70%'>%s</td><td>%s</td><td>%s</td></tr>\n",
_("Week"),
ok_nls=no, ok_nls=yes)
if test "$ok_nls" != "no"; then
- AC_MSG_RESULT(Checking to see if your system supports multithreaded NLS...)
+ AC_MSG_RESULT(Checking for per-thread NLS support...)
AC_TRY_RUN([
- #define _GNU_SOURCE
- #include <locale.h>
- #include <libintl.h>
- main() {
- char *foo;
- uselocale(LC_GLOBAL_LOCALE);
- foo = gettext("bar");
- exit(0);
+ #define _GNU_SOURCE
+ #include <libintl.h>
+ #include <locale.h>
+ #include <time.h>
+ main() {
+ char *foo = NULL;
+ char baz[32];
+ struct tm *tm;
+ uselocale(LC_GLOBAL_LOCALE);
+ foo = gettext("bar");
+ if (0) {
+ strftime_l(baz, sizeof baz, "%c", tm, LC_GLOBAL_LOCALE);
+ }
+ exit(0);
}
],
ok_uselocale=yes,
}
}
else {
- if (!strcasecmp(calhourformat, "24")) {
- sprintf(buf, "%s %d %d %2d:%02d",
- ascmonths[tm.tm_mon],
- tm.tm_mday,
- tm.tm_year + 1900,
- tm.tm_hour, tm.tm_min
- );
- }
- else {
- sprintf(buf, "%s %d %d %2d:%02d%s",
- ascmonths[tm.tm_mon],
- tm.tm_mday,
- tm.tm_year + 1900,
- hour, tm.tm_min, ((tm.tm_hour >= 12) ? "pm" : "am")
- );
- }
+ strftime_l(buf, 32, "%c", &tm, wc_locales[WC->selected_language]);
}
}
for (i = 0; i < NUM_LANGS; ++i) {
sprintf(buf, "%s.UTF8", AvailLang[i]);
- wc_locales[i] = newlocale(LC_MESSAGES_MASK /* |LC_TIME_MASK FIXME */ ,
+ wc_locales[i] = newlocale(
+ (LC_MESSAGES_MASK|LC_TIME_MASK),
buf,
Empty_Locale
);
+ if (wc_locales[i] == NULL) {
+ lprintf(1, "Error configuring locale for %s: %s\n",
+ buf,
+ strerror(errno)
+ );
+ }
+ else {
+ lprintf(3, "Configured available locale: %s\n", buf);
+ }
}
}
+++ /dev/null
-
-
-/* Convenience header for conditional use of GNU <libintl.h>.
- Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published
- by the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- USA. */
-
-#ifndef _LIBGETTEXT_H
-#define _LIBGETTEXT_H 1
-
-/* NLS can be disabled through the configure --disable-nls option. */
-#if ENABLE_NLS
-
-/* Get declarations of GNU message catalog functions. */
-# include <libintl.h>
-
-#else
-
-/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
- chokes if dcgettext is defined as a macro. So include it now, to make
- later inclusions of <locale.h> a NOP. We don't include <libintl.h>
- as well because people using "gettext.h" will not include <libintl.h>,
- and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
- is OK. */
-#if defined(__sun)
-# include <locale.h>
-#endif
-
-/* Disabled NLS.
- The casts to 'const char *' serve the purpose of producing warnings
- for invalid uses of the value returned from these functions.
- On pre-ANSI systems without 'const', the config.h file is supposed to
- contain "#define const". */
-# define gettext(Msgid) ((const char *) (Msgid))
-# define dgettext(Domainname, Msgid) ((const char *) (Msgid))
-# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
-# define ngettext(Msgid1, Msgid2, N) \
- ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
-# define dngettext(Domainname, Msgid1, Msgid2, N) \
- ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
-# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
- ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
-# define textdomain(Domainname) ((const char *) (Domainname))
-# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
-# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
-
-#endif
-
-/* A pseudo function call that serves as a marker for the automated
- extraction of messages, but does not call gettext(). The run-time
- translation is done at a different place in the code.
- The argument, String, should be a literal string. Concatenated strings
- and other string expressions won't work.
- The macro's expansion is not parenthesized, so that it is suitable as
- initializer for static 'char[]' or 'const char[]' variables. */
-#define gettext_noop(String) String
-
-#endif /* _LIBGETTEXT_H */
void output_date(void) {
struct tm tm;
time_t now;
-
- static char *wdays[7];
- static char *months[12];
-
- wdays[0] = _("Sunday");
- wdays[1] = _("Monday");
- wdays[2] = _("Tuesday");
- wdays[3] = _("Wednesday");
- wdays[4] = _("Thursday");
- wdays[5] = _("Friday");
- wdays[6] = _("Saturday");
-
- months[0] = _("January");
- months[1] = _("February");
- months[2] = _("March");
- months[3] = _("April");
- months[4] = _("May");
- months[5] = _("June");
- months[6] = _("July");
- months[7] = _("August");
- months[8] = _("September");
- months[9] = _("October");
- months[10] = _("November");
- months[11] = _("December");
+ char buf[128];
time(&now);
localtime_r(&now, &tm);
- wprintf("%s, %s %d, %d",
- wdays[tm.tm_wday],
- months[tm.tm_mon],
- tm.tm_mday,
- tm.tm_year + 1900
- );
+ strftime_l(buf, 32, "%A, %x", &tm, wc_locales[WC->selected_language]);
+ wprintf("%s", buf);
}
#include <iconv.h>
#endif
-#include "gettext.h"
-
-#if ENABLE_NLS
+#ifdef ENABLE_NLS
+#include <libintl.h>
#include <locale.h>
+extern locale_t wc_locales[];
#define _(string) gettext(string)
#else
#define _(string) (string)