1
0
mirror of https://github.com/anope/anope.git synced 2026-07-02 08:46:38 +02:00

Rework the config file reader to be much more flexible and move many configuration directives to the actual modules they are used in.

This commit is contained in:
Adam
2013-05-05 01:55:04 -04:00
parent 781defb707
commit 1d0bb9b26b
165 changed files with 3093 additions and 4861 deletions
+9 -6
View File
@@ -37,7 +37,7 @@ void Language::InitLanguages()
setlocale(LC_ALL, "");
spacesepstream sep(Config->Languages);
spacesepstream sep(Config->GetBlock("options")->Get<const Anope::string &>("languages"));
Anope::string language;
while (sep.GetToken(language))
{
@@ -58,7 +58,7 @@ void Language::InitLanguages()
const char *Language::Translate(const char *string)
{
return Translate(Config->NSDefLanguage.c_str(), string);
return Translate("", string);
}
const char *Language::Translate(User *u, const char *string)
@@ -66,12 +66,12 @@ const char *Language::Translate(User *u, const char *string)
if (u && u->Account())
return Translate(u->Account(), string);
else
return Translate(string);
return Translate("", string);
}
const char *Language::Translate(const NickCore *nc, const char *string)
{
return Translate(nc ? nc->language.c_str() : Config->NSDefLanguage.c_str(), string);
return Translate(nc ? nc->language.c_str() : "", string);
}
#if GETTEXT_FOUND
@@ -81,8 +81,11 @@ extern "C" int _nl_msg_cat_cntr;
const char *Language::Translate(const char *lang, const char *string)
{
if (!string || !*string || !lang || !*lang)
return string ? string : "";
if (!string || !*string)
return "";
if (!lang || !*lang)
lang = Config->DefLanguage.c_str();
++_nl_msg_cat_cntr;
#ifdef _WIN32