mirror of
https://github.com/anope/anope.git
synced 2026-07-06 08:33:14 +02:00
Allow users to change their language to english when the default language is not
This commit is contained in:
+1
-1
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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."));
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user