diff options
author | Adam <Adam@anope.org> | 2010-10-26 20:14:39 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-10-26 20:14:39 -0400 |
commit | 09160d1289d9359c090ce2f6cf47335dbf51223c (patch) | |
tree | c0f1abbde6e8b097a98443f0e7ce1d8325bee955 | |
parent | 1d931401cd00848b7ba10c13b0e2771935395aa6 (diff) |
Fixed Windows build with gettext
-rw-r--r-- | include/services.h | 2 | ||||
-rw-r--r-- | src/language.cpp | 5 | ||||
-rw-r--r-- | src/modules.cpp | 5 |
3 files changed, 10 insertions, 2 deletions
diff --git a/include/services.h b/include/services.h index 55993cd1f..50ea809a6 100644 --- a/include/services.h +++ b/include/services.h @@ -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); diff --git a/src/language.cpp b/src/language.cpp index 885394b0c..ffaf3acb0 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -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"); diff --git a/src/modules.cpp b/src/modules.cpp index afcbb9ae6..eb7462d1a 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -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"); |