mirror of
https://github.com/anope/anope.git
synced 2026-07-07 18:43:13 +02:00
Fixed Windows build with gettext
This commit is contained in:
@@ -77,6 +77,8 @@
|
||||
/* We have our own inet_pton and inet_ntop (Windows doesn't have its own) */
|
||||
# define inet_pton inet_pton_
|
||||
# define inet_ntop inet_ntop_
|
||||
# define setenv(x, y, z) SetEnvironmentVariable(x, y)
|
||||
# define unsetenv(x) SetEnvironmentVariable(x, NULL)
|
||||
# define MARK_DEPRECATED
|
||||
|
||||
extern CoreExport int inet_pton(int af, const char *src, void *dst);
|
||||
|
||||
+4
-1
@@ -38,6 +38,10 @@ void InitLanguages()
|
||||
#endif
|
||||
}
|
||||
|
||||
#if GETTEXT_FOUND
|
||||
/* Used by gettext to make it always dynamically load language strings (so we can drop them in while Anope is running) */
|
||||
extern "C" int _nl_msg_cat_cntr;
|
||||
#endif
|
||||
const Anope::string GetString(Anope::string language, LanguageString string)
|
||||
{
|
||||
#if GETTEXT_FOUND
|
||||
@@ -54,7 +58,6 @@ const Anope::string GetString(Anope::string language, LanguageString string)
|
||||
return language_strings[string];
|
||||
|
||||
#if GETTEXT_FOUND
|
||||
extern int _nl_msg_cat_cntr;
|
||||
++_nl_msg_cat_cntr;
|
||||
setenv("LANGUAGE", language.c_str(), 1);
|
||||
setlocale(LC_ALL, "en_US");
|
||||
|
||||
+4
-1
@@ -286,6 +286,10 @@ Version Module::GetVersion() const
|
||||
return Version(VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD);
|
||||
}
|
||||
|
||||
#if GETTEXT_FOUND
|
||||
/* Used by gettext to make it always dynamically load language strings (so we can drop them in while Anope is running) */
|
||||
extern "C" int _nl_msg_cat_cntr;
|
||||
#endif
|
||||
void Module::SendMessage(BotInfo *from, User *to, const char *fmt, ...)
|
||||
{
|
||||
Anope::string language = (to && to->Account() ? to->Account()->language : "");
|
||||
@@ -299,7 +303,6 @@ void Module::SendMessage(BotInfo *from, User *to, const char *fmt, ...)
|
||||
#if GETTEXT_FOUND
|
||||
if (!language.empty())
|
||||
{
|
||||
extern int _nl_msg_cat_cntr;
|
||||
++_nl_msg_cat_cntr;
|
||||
setenv("LANGUAGE", language.c_str(), 1);
|
||||
setlocale(LC_ALL, "en_US");
|
||||
|
||||
Reference in New Issue
Block a user