diff options
Diffstat (limited to 'src/language.cpp')
-rw-r--r-- | src/language.cpp | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/src/language.cpp b/src/language.cpp index 0a19729b1..8c3e6221a 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -1,12 +1,20 @@ /* + * Anope IRC Services * - * (C) 2003-2016 Anope Team - * Contact us at team@anope.org + * Copyright (C) 2003-2016 Anope Team <team@anope.org> * - * Please read COPYING and README for further details. + * This file is part of Anope. Anope is free software; you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software + * Foundation, version 2. * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see see <http://www.gnu.org/licenses/>. */ #include "services.h" @@ -14,6 +22,7 @@ #include "commands.h" #include "config.h" #include "language.h" +#include "modules/nickserv.h" #if GETTEXT_FOUND # include <libintl.h> @@ -36,7 +45,7 @@ void Language::InitLanguages() setlocale(LC_ALL, ""); - spacesepstream sep(Config->GetBlock("options")->Get<const Anope::string>("languages")); + spacesepstream sep(Config->GetBlock("options")->Get<Anope::string>("languages")); Anope::string language; while (sep.GetToken(language)) { @@ -60,6 +69,11 @@ const char *Language::Translate(const char *string) return Translate("", string); } +const char *Language::Translate(const Anope::string &string) +{ + return Translate("", string.c_str()); +} + const char *Language::Translate(User *u, const char *string) { if (u && u->Account()) @@ -68,9 +82,19 @@ const char *Language::Translate(User *u, const char *string) return Translate("", string); } -const char *Language::Translate(const NickCore *nc, const char *string) +const char *Language::Translate(User *u, const Anope::string &string) +{ + return Translate(u, string.c_str()); +} + +const char *Language::Translate(NickServ::Account *nc, const char *string) +{ + return Translate(nc ? nc->GetLanguage().c_str() : "", string); +} + +const char *Language::Translate(NickServ::Account *nc, const Anope::string &string) { - return Translate(nc ? nc->language.c_str() : "", string); + return Translate(nc, string.c_str()); } #if GETTEXT_FOUND |