diff options
author | Adam <Adam@anope.org> | 2013-06-12 02:30:21 +0000 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-06-12 02:30:21 +0000 |
commit | d463ae3b1eb44085ad06193f403bc8ec67b34422 (patch) | |
tree | 63826af31a8095cddd33156ab06f6493cb79f0ec | |
parent | ebda113f448cdde52d4015b75b09211eac182c8e (diff) |
Allow users to change their language to english when the default language is not
-rw-r--r-- | include/language.h | 2 | ||||
-rw-r--r-- | modules/commands/ns_set.cpp | 19 | ||||
-rw-r--r-- | src/language.cpp | 5 |
3 files changed, 15 insertions, 11 deletions
diff --git a/include/language.h b/include/language.h index 42d95383d..f0dd27782 100644 --- a/include/language.h +++ b/include/language.h @@ -55,7 +55,7 @@ namespace Language extern CoreExport const char *Translate(const NickCore *nc, const char *string); /** Translatesa string to the given language. - * @param lang The language to trnalsate to + * @param lang The language to translate to * @param string The string to translate * @return The translated string if found, else the original string. */ diff --git a/modules/commands/ns_set.cpp b/modules/commands/ns_set.cpp index 4b2dfe684..7b0de5565 100644 --- a/modules/commands/ns_set.cpp +++ b/modules/commands/ns_set.cpp @@ -941,20 +941,21 @@ class CommandNSSetLanguage : public Command if (MOD_RESULT == EVENT_STOP) return; - for (unsigned j = 0; j < Language::Languages.size(); ++j) - { - if (param == "en" || Language::Languages[j] == param) - break; - else if (j + 1 == Language::Languages.size()) + if (param != "en") + for (unsigned j = 0; j < Language::Languages.size(); ++j) { - this->OnSyntaxError(source, ""); - return; + if (Language::Languages[j] == param) + break; + else if (j + 1 == Language::Languages.size()) + { + this->OnSyntaxError(source, ""); + return; + } } - } Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the langauge of " << nc->display << " to " << param; - nc->language = param != "en" ? param : ""; + nc->language = param; source.Reply(_("Language changed to \002English\002.")); } diff --git a/src/language.cpp b/src/language.cpp index aa2c3b2e9..6ae7ab152 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -41,7 +41,7 @@ void Language::InitLanguages() Anope::string language; while (sep.GetToken(language)) { - const Anope::string &lang_name = Translate(language.c_str(), "English"); + const Anope::string &lang_name = Translate(language.c_str(), _("English")); if (lang_name == "English") { Log() << "Unable to use language " << language; @@ -86,6 +86,9 @@ const char *Language::Translate(const char *lang, const char *string) if (!lang || !*lang) lang = Config->DefLanguage.c_str(); + + if (Anope::string(lang) == "en") + return string != NULL ? string : ""; ++_nl_msg_cat_cntr; #ifdef _WIN32 |