mirror of
https://github.com/Tha14/toxic.git
synced 2025-07-03 12:16:44 +02:00
Add localization system (gettext)
This commit is contained in:
12
src/log.c
12
src/log.c
@ -25,6 +25,12 @@
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef NO_GETTEXT
|
||||
#define gettext(A) (A)
|
||||
#else
|
||||
#include <libintl.h>
|
||||
#endif
|
||||
|
||||
#include "configdir.h"
|
||||
#include "toxic.h"
|
||||
#include "windows.h"
|
||||
@ -180,17 +186,17 @@ void load_chat_history(ToxWindow *self, struct chatlog *log)
|
||||
char *hstbuf = malloc(sz);
|
||||
|
||||
if (hstbuf == NULL)
|
||||
exit_toxic_err("failed in load_chat_history", FATALERR_MEMORY);
|
||||
exit_toxic_err(gettext("failed in load_chat_history"), FATALERR_MEMORY);
|
||||
|
||||
if (fseek(log->file, 0L, SEEK_SET) == -1) {
|
||||
free(hstbuf);
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, RED, " * Failed to read log file");
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, RED, gettext(" * Failed to read log file"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (fread(hstbuf, sz, 1, log->file) != 1) {
|
||||
free(hstbuf);
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, RED, " * Failed to read log file");
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, RED, gettext(" * Failed to read log file"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user