mirror of
https://github.com/moparisthebest/minetest
synced 2024-11-07 18:05:08 -05:00
e034f8a2a3
Now the user-level option is called ENABLE_GETTEXT, and USE_GETTEXT is only set to true if gettext was enabled and found. This simplifies all check to USE_GETTEXT only rather than the double checks for it being enabled and found.
26 lines
508 B
C
26 lines
508 B
C
#if USE_GETTEXT
|
|
#include <libintl.h>
|
|
#else
|
|
#define gettext(String) String
|
|
#endif
|
|
|
|
#define _(String) gettext(String)
|
|
#define gettext_noop(String) String
|
|
#define N_(String) gettext_noop (String)
|
|
|
|
inline void init_gettext(const char *path) {
|
|
#if USE_GETTEXT
|
|
setlocale(LC_MESSAGES, "");
|
|
bindtextdomain(PROJECT_NAME, path);
|
|
textdomain(PROJECT_NAME);
|
|
#endif
|
|
}
|
|
|
|
inline wchar_t* chartowchar_t(const char *str)
|
|
{
|
|
size_t l = strlen(str)+1;
|
|
wchar_t* nstr = new wchar_t[l];
|
|
mbstowcs(nstr, str, l);
|
|
return nstr;
|
|
}
|