diff options
author | Adam <Adam@anope.org> | 2017-01-23 12:35:14 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2017-01-23 12:35:14 -0500 |
commit | 16ca76c2e7ab287e480185fbb03a0bb438351eda (patch) | |
tree | dfb25534afa2352b65b2ee707086cb5eecc96fbb /src/language.cpp | |
parent | ff030c1eb7c3764f9add2a689479e84d616cabcb (diff) |
Make log system use newer format strings
Also allow log messages to be translatable
Diffstat (limited to 'src/language.cpp')
-rw-r--r-- | src/language.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/language.cpp b/src/language.cpp index 8c3e6221a..238449aaa 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -34,14 +34,14 @@ std::vector<Anope::string> Language::Domains; void Language::InitLanguages() { #if GETTEXT_FOUND - Log(LOG_DEBUG) << "Initializing Languages..."; + Anope::Logger.Debug("Initializing Languages..."); Languages.clear(); if (!bindtextdomain("anope", Anope::LocaleDir.c_str())) - Log() << "Error calling bindtextdomain, " << Anope::LastError(); + Anope::Logger.Log("Error calling bindtextdomain, {0}", Anope::LastError()); else - Log(LOG_DEBUG) << "Successfully bound anope to " << Anope::LocaleDir; + Anope::Logger.Debug("Successfully bound anope to {0}", Anope::LocaleDir); setlocale(LC_ALL, ""); @@ -52,15 +52,15 @@ void Language::InitLanguages() const Anope::string &lang_name = Translate(language.c_str(), _("English")); if (lang_name == "English") { - Log() << "Unable to use language " << language; + Anope::Logger.Log("Unable to use language {0}", language); continue; } - Log(LOG_DEBUG) << "Found language " << language; + Anope::Logger.Debug("Found language {0}", language); Languages.push_back(language); } #else - Log() << "Unable to initialize languages, gettext is not installed"; + Anope::Logger.Log("Unable to initialize languages, gettext is not installed"); #endif } @@ -109,7 +109,12 @@ const char *Language::Translate(const char *lang, const char *string) return ""; if (!lang || !*lang) + { + if (Config == nullptr) + return string; + lang = Config->DefLanguage.c_str(); + } #ifdef __USE_GNU_GETTEXT ++_nl_msg_cat_cntr; |