diff --git a/modules/controlpanel.cpp b/modules/controlpanel.cpp index 91be3fc2..44451d6c 100644 --- a/modules/controlpanel.cpp +++ b/modules/controlpanel.cpp @@ -105,6 +105,9 @@ class CAdminMod : public CModule { {"TimestampFormat", str}, {"DCCBindHost", str}, {"StatusPrefix", str}, +#ifdef HAVE_I18N + {"Language", str}, +#endif #ifdef HAVE_ICU {"ClientEncoding", str}, #endif @@ -266,6 +269,10 @@ class CAdminMod : public CModule { PutModule("Admin = " + CString(pUser->IsAdmin())); else if (sVar == "statusprefix") PutModule("StatusPrefix = " + pUser->GetStatusPrefix()); +#ifdef HAVE_I18N + else if (sVar == "language") + PutModule("Language = " + pUser->GetLanguage()); +#endif #ifdef HAVE_ICU else if (sVar == "clientencoding") PutModule("ClientEncoding = " + pUser->GetClientEncoding()); @@ -430,6 +437,12 @@ class CAdminMod : public CModule { PutModule("That would be a bad idea!"); } } +#ifdef HAVE_I18N + else if (sVar == "language") { + pUser->SetLanguage(sValue); + PutModule("Language = " + pUser->GetLanguage()); + } +#endif #ifdef HAVE_ICU else if (sVar == "clientencoding") { pUser->SetClientEncoding(sValue); diff --git a/modules/data/webadmin/tmpl/add_edit_user.tmpl b/modules/data/webadmin/tmpl/add_edit_user.tmpl index 3b347169..f3e7923f 100644 --- a/modules/data/webadmin/tmpl/add_edit_user.tmpl +++ b/modules/data/webadmin/tmpl/add_edit_user.tmpl @@ -364,6 +364,21 @@ + +
+
Language:
+ + + + + ZNC is compiled without i18n support + +
+
diff --git a/modules/webadmin.cpp b/modules/webadmin.cpp index 32439b80..a9a303d8 100644 --- a/modules/webadmin.cpp +++ b/modules/webadmin.cpp @@ -306,6 +306,9 @@ class CWebAdminMod : public CModule { pNewUser->SetMaxQueryBuffers( WebSock.GetParam("maxquerybuffers").ToUInt()); +#ifdef HAVE_I18N + pNewUser->SetLanguage(WebSock.GetParam("language")); +#endif #ifdef HAVE_ICU CString sEncodingUtf = WebSock.GetParam("encoding_utf"); if (sEncodingUtf == "legacy") { @@ -1298,6 +1301,7 @@ class CWebAdminMod : public CModule { Tmpl["MaxNetworks"] = CString(pUser->MaxNetworks()); Tmpl["MaxJoins"] = CString(pUser->MaxJoins()); Tmpl["MaxQueryBuffers"] = CString(pUser->MaxQueryBuffers()); + Tmpl["Language"] = pUser->GetLanguage(); const set& ssAllowedHosts = pUser->GetAllowedHosts(); for (const CString& sHost : ssAllowedHosts) { @@ -1337,6 +1341,18 @@ class CWebAdminMod : public CModule { l["TZ"] = sTZ; } +#ifdef HAVE_I18N + Tmpl["HaveI18N"] = "true"; + // TODO don't have them hardcoded here + CTemplate& l_en = Tmpl.AddRow("LanguageLoop"); + l_en["Code"] = ""; + l_en["Name"] = "English"; + CTemplate& l_ru = Tmpl.AddRow("LanguageLoop"); + l_ru["Code"] = "ru_RU"; + l_ru["Name"] = "Russian"; +#else + Tmpl["HaveI18N"] = "false"; +#endif #ifdef HAVE_ICU for (const CString& sEncoding : CUtils::GetEncodings()) { CTemplate& l = Tmpl.AddRow("EncodingLoop");