summaryrefslogtreecommitdiff
path: root/src/utils/gettexthelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/gettexthelper.cpp')
-rw-r--r--src/utils/gettexthelper.cpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/utils/gettexthelper.cpp b/src/utils/gettexthelper.cpp
index 66ebcb469..fadc19530 100644
--- a/src/utils/gettexthelper.cpp
+++ b/src/utils/gettexthelper.cpp
@@ -1,8 +1,9 @@
/*
- * The ManaPlus Client
- * Copyright (C) 2011-2019 The ManaPlus Developers
+ * The ManaVerse Client
+ * Copyright (C) 2011-2020 The ManaPlus Developers
+ * Copyright (C) 2020-2025 The ManaVerse Developers
*
- * This file is part of The ManaPlus Client.
+ * This file is part of The ManaVerse Client.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -33,10 +34,10 @@
#include <libintl.h>
#include <locale.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <string>
extern "C" char const *_nl_locale_name_default(void);
-#endif // WIN32
+#endif // _WIN32
#elif defined(ENABLE_CUSTOMNLS)
#include "utils/translation/podict.h"
#ifdef __native_client__
@@ -44,9 +45,9 @@ extern "C" char const *_nl_locale_name_default(void);
#endif // __native_client__
#endif // ENABLE_NLS
-#if defined(ENABLE_NLS) || defined(ENABLE_CUSTOMNLS) && !defined(WIN32)
+#if defined(ENABLE_NLS) || defined(ENABLE_CUSTOMNLS) && !defined(_WIN32)
#include "utils/env.h"
-#endif // defined(ENABLE_NLS) || defined(ENABLE_CUSTOMNLS) && !defined(WIN32)
+#endif // defined(ENABLE_NLS) || defined(ENABLE_CUSTOMNLS) && !defined(_WIN32)
#include "debug.h"
@@ -54,7 +55,7 @@ extern "C" char const *_nl_locale_name_default(void);
static std::string setLangEnv()
{
std::string lang = config.getStringValue("lang");
-#if defined(ENABLE_NLS) && defined(WIN32)
+#if defined(ENABLE_NLS) && defined(_WIN32)
if (lang.empty())
lang = std::string(_nl_locale_name_default());
#elif defined(ENABLE_CUSTOMNLS) && defined(__native_client__)
@@ -65,18 +66,18 @@ static std::string setLangEnv()
naclPostMessage("get-uilanguage", "");
lang = naclWaitForMessage(handle);
}
-#endif // defined(ENABLE_NLS) && defined(WIN32)
+#endif // defined(ENABLE_NLS) && defined(_WIN32)
if (!lang.empty())
{
-#ifdef WIN32
+#ifdef _WIN32
putenv(const_cast<char*>(("LANG=" + lang).c_str()));
putenv(const_cast<char*>(("LANGUAGE=" + lang).c_str()));
-#else // WIN32
+#else // _WIN32
setEnv("LANG", lang.c_str());
setEnv("LANGUAGE", lang.c_str());
-#endif // WIN32
+#endif // _WIN32
}
return lang;
@@ -87,11 +88,11 @@ void GettextHelper::initLang()
{
#ifdef ENABLE_NLS
const std::string lang = setLangEnv();
-#ifdef WIN32
+#ifdef _WIN32
// mingw doesn't like LOCALEDIR to be defined for some reason
if (lang != "C")
bindTextDomain("translations/");
-#else // WIN32
+#else // _WIN32
#ifdef ANDROID
#ifdef USE_SDL2
bindTextDomain((std::string(getenv("APPDIR")).append("/locale")).c_str());
@@ -114,7 +115,7 @@ void GettextHelper::initLang()
#endif // __APPLE__
#endif // ENABLE_PORTABLE
#endif // ANDROID
-#endif // WIN32
+#endif // _WIN32
char *locale = setlocale(LC_MESSAGES, lang.c_str());
if (locale)