summaryrefslogtreecommitdiff
path: root/src/module.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-06-17 19:57:43 -0400
committerAdam <Adam@anope.org>2011-06-17 19:57:43 -0400
commita1b36ec0a527e6d7a9d224b56bf9571619d5f92e (patch)
tree5e74290f46205ef1ad86700e1f04ec016b1f66fd /src/module.cpp
parent48e995ddf2cd30a05222a51e665c02b1e7ae567a (diff)
Search all domains for language strings, fixes the mess that we used to use to translate strings in 3rd party modules
Diffstat (limited to 'src/module.cpp')
-rw-r--r--src/module.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/module.cpp b/src/module.cpp
index 929984e2e..7ec6892ac 100644
--- a/src/module.cpp
+++ b/src/module.cpp
@@ -28,8 +28,15 @@ Module::Module(const Anope::string &modname, const Anope::string &, ModType modt
Modules.push_back(this);
#if GETTEXT_FOUND
- if (!bindtextdomain(this->name.c_str(), (services_dir + "/languages/").c_str()))
- Log() << "Error calling bindtextdomain, " << Anope::LastError();
+ for (unsigned i = 0; i < languages.size(); ++i)
+ if (IsFile("languages/" + languages[i] + "/LC_MESSAGES/" + modname + ".mo"))
+ {
+ if (!bindtextdomain(this->name.c_str(), (services_dir + "/languages/").c_str()))
+ Log() << "Error calling bindtextdomain, " << Anope::LastError();
+ else
+ domains.push_back(modname);
+ break;
+ }
#endif
}
@@ -45,6 +52,12 @@ Module::~Module()
std::list<Module *>::iterator it = std::find(Modules.begin(), Modules.end(), this);
if (it != Modules.end())
Modules.erase(it);
+
+#if GETTEXT_FOUND
+ std::vector<Anope::string>::iterator dit = std::find(domains.begin(), domains.end(), this->name);
+ if (dit != domains.end())
+ domains.erase(dit);
+#endif
}
void Module::SetPermanent(bool state)