Skip to content
Snippets Groups Projects
gettext.h 543 B
Newer Older
Giuseppe Bilotta's avatar
Giuseppe Bilotta committed
#if defined(GETTEXT_FOUND) && defined(USE_GETTEXT)
Constantin Wenger's avatar
Constantin Wenger committed
#include <libintl.h>
Giuseppe Bilotta's avatar
Giuseppe Bilotta committed
#else
#define gettext(String) String
Constantin Wenger's avatar
Constantin Wenger committed
#define _(String) gettext(String)
#define gettext_noop(String) String
#define N_(String) gettext_noop (String)

Giuseppe Bilotta's avatar
Giuseppe Bilotta committed
inline void init_gettext(const char *path) {
#if USE_GETTEXT
	setlocale(LC_MESSAGES, "");
	bindtextdomain(PROJECT_NAME, path);
	textdomain(PROJECT_NAME);
#endif
}

Giuseppe Bilotta's avatar
Giuseppe Bilotta committed
inline wchar_t* chartowchar_t(const char *str)
Constantin Wenger's avatar
Constantin Wenger committed
{
	size_t l = strlen(str)+1;
	wchar_t* nstr = new wchar_t[l];
	mbstowcs(nstr, str, l);
	return nstr;
}