mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Refactor gettext init
Put the gettext init code in a macro and define it appropriately depending on whether gettext is actually available or not.
This commit is contained in:
parent
5aa2679be7
commit
c578efb32b
2 changed files with 10 additions and 14 deletions
|
@ -1,21 +1,21 @@
|
|||
#ifdef GETTEXT_FOUND
|
||||
#ifdef USE_GETTEXT
|
||||
#if defined(GETTEXT_FOUND) && defined(USE_GETTEXT)
|
||||
#include <libintl.h>
|
||||
#else
|
||||
#define gettext(String) String
|
||||
#define bindtextdomain(domain, dir) /* */
|
||||
#define textdomain(domain) /* */
|
||||
#endif
|
||||
#else
|
||||
#define gettext(String) String
|
||||
#define bindtextdomain(domain, dir) /* */
|
||||
#define textdomain(domain) /* */
|
||||
#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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue