summaryrefslogtreecommitdiff
path: root/src/modules.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-10-23 16:12:15 -0400
committerAdam <Adam@anope.org>2010-10-23 16:12:15 -0400
commitec5fa9e63e54fc9eaef5d4b5d6b31bdcf7161031 (patch)
treeb1f99b74d1aab0564ca9a5cded7d9bd1668fbfc3 /src/modules.cpp
parent7e47b9774058b29e117a9aab37e25b3f725fa837 (diff)
Made the language system still work even if the locales are not installed on the system
Diffstat (limited to 'src/modules.cpp')
-rw-r--r--src/modules.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/modules.cpp b/src/modules.cpp
index a76f2c5da..afcbb9ae6 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -299,9 +299,12 @@ void Module::SendMessage(BotInfo *from, User *to, const char *fmt, ...)
#if GETTEXT_FOUND
if (!language.empty())
{
- setlocale(LC_ALL, language.c_str());
+ extern int _nl_msg_cat_cntr;
+ ++_nl_msg_cat_cntr;
+ setenv("LANGUAGE", language.c_str(), 1);
+ setlocale(LC_ALL, "en_US");
message = dgettext(this->name.c_str(), fmt);
- setlocale(LC_ALL, "");
+ unsetenv("LANGUAGE");
}
#endif