Fix compilation with NLS disabled
* src/utils.c: Only call setlocale() if NLS is enabled. * src/calcurse.h: Define a fallback macro ngettext() if NLS is disabled. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
@@ -383,15 +383,19 @@ char *date_sec2date_str(long sec, const char *datefmt)
|
||||
/* Generic function to format date. */
|
||||
void date_sec2date_fmt(long sec, const char *fmt, char *datef)
|
||||
{
|
||||
#if ENABLE_NLS
|
||||
/* TODO: Find a better way to deal with localization and strftime(). */
|
||||
char *locale_old = mem_strdup (setlocale (LC_ALL, NULL));
|
||||
setlocale (LC_ALL, "C");
|
||||
#endif
|
||||
|
||||
struct tm *lt = localtime((time_t *)&sec);
|
||||
strftime(datef, BUFSIZ, fmt, lt);
|
||||
|
||||
#if ENABLE_NLS
|
||||
setlocale (LC_ALL, locale_old);
|
||||
mem_free (locale_old);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user