From 9c8988ab57c872193a84a3505bb48de6b4654913 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 11 Jan 2020 18:48:47 +0000 Subject: [PATCH 1/2] Don't make locale code dependent on GETTEXT, save that for the actual gettext related stuff! --- src/d_main.c | 2 -- src/doomdef.h | 2 +- src/m_misc.c | 18 +++++++++++------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index e55c65bbb..1001e99a9 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1046,10 +1046,8 @@ void D_SRB2Main(void) I_OutputMsg("setvbuf didnt work\n"); #endif -#ifdef GETTEXT // initialise locale code M_StartupLocale(); -#endif // get parameters from a response file (eg: srb2 @parms.txt) M_FindResponseFile(); diff --git a/src/doomdef.h b/src/doomdef.h index 55ad8abed..1c4e9dc89 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -98,8 +98,8 @@ #ifdef GETTEXT #include -#include #endif +#include // locale should not be dependent on GETTEXT -- 11/01/20 Monster Iestyn #include #include diff --git a/src/m_misc.c b/src/m_misc.c index 83c0c7bec..5ee7b0ac9 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1594,16 +1594,19 @@ boolean M_ScreenshotResponder(event_t *ev) // M_StartupLocale. // Sets up gettext to translate SRB2's strings. #ifdef GETTEXT -#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) -#define GETTEXTDOMAIN1 "/usr/share/locale" -#define GETTEXTDOMAIN2 "/usr/local/share/locale" -#elif defined (_WIN32) -#define GETTEXTDOMAIN1 "." -#endif + #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) + #define GETTEXTDOMAIN1 "/usr/share/locale" + #define GETTEXTDOMAIN2 "/usr/local/share/locale" + #elif defined (_WIN32) + #define GETTEXTDOMAIN1 "." + #endif +#endif // GETTEXT void M_StartupLocale(void) { +#ifdef GETTEXT char *textdomhandle = NULL; +#endif //GETTEXT CONS_Printf("M_StartupLocale...\n"); @@ -1612,6 +1615,7 @@ void M_StartupLocale(void) // Do not set numeric locale as that affects atof setlocale(LC_NUMERIC, "C"); +#ifdef GETTEXT // FIXME: global name define anywhere? #ifdef GETTEXTDOMAIN1 textdomhandle = bindtextdomain("srb2", GETTEXTDOMAIN1); @@ -1632,8 +1636,8 @@ void M_StartupLocale(void) textdomain("srb2"); else CONS_Printf("Could not find locale text domain!\n"); +#endif //GETTEXT } -#endif // ========================================================================== // MISC STRING FUNCTIONS From 1643e6623df1eeed9d02e399bfc9444f3bfa1a95 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 11 Jan 2020 20:24:43 +0000 Subject: [PATCH 2/2] whoops, forgot to do this --- src/doomdef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doomdef.h b/src/doomdef.h index 1c4e9dc89..696071597 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -451,12 +451,12 @@ char savegamename[256]; // m_misc.h #ifdef GETTEXT #define M_GetText(String) gettext(String) -void M_StartupLocale(void); #else // If no translations are to be used, make a stub // M_GetText function that just returns the string. #define M_GetText(x) (x) #endif +void M_StartupLocale(void); extern void *(*M_Memcpy)(void* dest, const void* src, size_t n) FUNCNONNULL; char *va(const char *format, ...) FUNCPRINTF; char *M_GetToken(const char *inputString);