diff --git a/modules/data/notes/tmpl/index.tmpl b/modules/data/notes/tmpl/index.tmpl index 1ab0cc41..e4087ca3 100644 --- a/modules/data/notes/tmpl/index.tmpl +++ b/modules/data/notes/tmpl/index.tmpl @@ -1,21 +1,22 @@ +
-

Add A Note

+

-
Key:
+
-
Note:
+
- + " />
@@ -23,21 +24,21 @@ -

You have no notes to display.

+

- - + + - + diff --git a/modules/data/perform/tmpl/index.tmpl b/modules/data/perform/tmpl/index.tmpl index ffd768aa..b10d0bc4 100644 --- a/modules/data/perform/tmpl/index.tmpl +++ b/modules/data/perform/tmpl/index.tmpl @@ -1,20 +1,21 @@ +
-

Perform

+

-
Perform commands:
+
-
Commands sent to the IRC server on connect, one per line. +
- + " />
diff --git a/modules/nickserv.cpp b/modules/nickserv.cpp index 138829b0..24066ef3 100644 --- a/modules/nickserv.cpp +++ b/modules/nickserv.cpp @@ -28,14 +28,14 @@ class CNickServ : public CModule { public: void SetCommand(const CString& sLine) { SetNV("Password", sLine.Token(1, true)); - PutModule("Password set"); + PutModule(t_s("Password set")); } void ClearCommand(const CString& sLine) { DelNV("Password"); } void SetNSNameCommand(const CString& sLine) { SetNV("NickServName", sLine.Token(1, true)); - PutModule("NickServ name set"); + PutModule(t_s("NickServ name set")); } void ClearNSNameCommand(const CString& sLine) { DelNV("NickServName"); } @@ -50,35 +50,33 @@ class CNickServ : public CModule { if (sCmd.Equals("IDENTIFY")) { SetNV("IdentifyCmd", sNewCmd); } else { - PutModule("No such editable command. See ViewCommands for list."); + PutModule( + t_s("No such editable command. See ViewCommands for list.")); return; } - PutModule("Ok"); + PutModule(t_s("Ok")); } MODCONSTRUCTOR(CNickServ) { AddHelpCommand(); - AddCommand("Set", - static_cast(&CNickServ::SetCommand), - "password"); - AddCommand("Clear", static_cast( - &CNickServ::ClearCommand), - "", "Clear your nickserv password"); - AddCommand("SetNSName", static_cast( - &CNickServ::SetNSNameCommand), - "nickname", - "Set NickServ name (Useful on networks like EpiKnet, where " - "NickServ is named Themis)"); - AddCommand("ClearNSName", static_cast( - &CNickServ::ClearNSNameCommand), - "", "Reset NickServ name to default (NickServ)"); - AddCommand("ViewCommands", static_cast( - &CNickServ::ViewCommandsCommand), - "", - "Show patterns for lines, which are being sent to NickServ"); - AddCommand("SetCommand", static_cast( - &CNickServ::SetCommandCommand), - "cmd new-pattern", "Set pattern for commands"); + AddCommand("Set", t_d("password"), t_d("Set your nickserv password"), + [=](const CString& sLine) { SetCommand(sLine); }); + AddCommand("Clear", "", t_d("Clear your nickserv password"), + [=](const CString& sLine) { ClearCommand(sLine); }); + AddCommand("SetNSName", t_d("nickname"), + t_d("Set NickServ name (Useful on networks like EpiKnet, " + "where NickServ is named Themis"), + [=](const CString& sLine) { SetNSNameCommand(sLine); }); + AddCommand("ClearNSName", "", + t_d("Reset NickServ name to default (NickServ)"), + [=](const CString& sLine) { ClearNSNameCommand(sLine); }); + AddCommand( + "ViewCommands", "", + t_d("Show patterns for lines, which are being sent to NickServ"), + [=](const CString& sLine) { ViewCommandsCommand(sLine); }); + AddCommand("SetCommand", t_d("cmd new-pattern"), + t_d("Set pattern for commands"), + [=](const CString& sLine) { SetCommandCommand(sLine); }); } ~CNickServ() override {} @@ -139,7 +137,8 @@ template <> void TModInfo(CModInfo& Info) { Info.SetWikiPage("nickserv"); Info.SetHasArgs(true); - Info.SetArgsHelpText("Please enter your nickserv password."); + Info.SetArgsHelpText(Info.t_s("Please enter your nickserv password.")); } -NETWORKMODULEDEFS(CNickServ, "Auths you with NickServ") +NETWORKMODULEDEFS(CNickServ, + t_s("Auths you with NickServ (prefer SASL module instead)")) diff --git a/modules/notes.cpp b/modules/notes.cpp index 61ba5ab8..0b532ca9 100644 --- a/modules/notes.cpp +++ b/modules/notes.cpp @@ -29,12 +29,12 @@ class CNotesMod : public CModule { if (!GetNV(sKey).empty()) { PutModule( - "That note already exists. Use MOD to " - "overwrite."); + t_s("That note already exists. Use MOD to " + "overwrite.")); } else if (AddNote(sKey, sValue)) { - PutModule("Added note [" + sKey + "]"); + PutModule(t_f("Added note {1}")(sKey)); } else { - PutModule("Unable to add note [" + sKey + "]"); + PutModule(t_f("Unable to add note {1}")(sKey)); } } @@ -43,9 +43,9 @@ class CNotesMod : public CModule { CString sValue(sLine.Token(2, true)); if (AddNote(sKey, sValue)) { - PutModule("Set note for [" + sKey + "]"); + PutModule(t_f("Set note for {1}")(sKey)); } else { - PutModule("Unable to add note [" + sKey + "]"); + PutModule(t_f("Unable to add note {1}")(sKey)); } } @@ -53,7 +53,7 @@ class CNotesMod : public CModule { CString sNote = GetNV(sLine.Token(1, true)); if (sNote.empty()) { - PutModule("This note doesn't exist."); + PutModule(t_s("This note doesn't exist.")); } else { PutModule(sNote); } @@ -63,28 +63,25 @@ class CNotesMod : public CModule { CString sKey(sLine.Token(1)); if (DelNote(sKey)) { - PutModule("Deleted note [" + sKey + "]"); + PutModule(t_f("Deleted note {1}")(sKey)); } else { - PutModule("Unable to delete note [" + sKey + "]"); + PutModule(t_f("Unable to delete note {1}")(sKey)); } } public: MODCONSTRUCTOR(CNotesMod) { - using std::placeholders::_1; AddHelpCommand(); - AddCommand("List", static_cast( - &CNotesMod::ListCommand)); - AddCommand("Add", static_cast( - &CNotesMod::AddNoteCommand), - " "); - AddCommand("Del", - static_cast(&CNotesMod::DelCommand), - "", "Delete a note"); - AddCommand("Mod", " ", "Modify a note", - std::bind(&CNotesMod::ModCommand, this, _1)); - AddCommand("Get", "", "", - [this](const CString& sLine) { GetCommand(sLine); }); + AddCommand("List", "", t_d("List notes"), + [=](const CString& sLine) { ListCommand(sLine); }); + AddCommand("Add", t_d(" "), t_d("Add a note"), + [=](const CString& sLine) { AddNoteCommand(sLine); }); + AddCommand("Del", t_d(""), t_d("Delete a note"), + [=](const CString& sLine) { DelCommand(sLine); }); + AddCommand("Mod", t_d(" "), t_d("Modify a note"), + [=](const CString& sLine) { ModCommand(sLine); }); + AddCommand("Get", t_d(""), "", + [=](const CString& sLine) { GetCommand(sLine); }); } ~CNotesMod() override {} @@ -94,7 +91,7 @@ class CNotesMod : public CModule { return true; } - CString GetWebMenuTitle() override { return "Notes"; } + CString GetWebMenuTitle() override { return t_s("Notes"); } void OnClientLogin() override { if (m_bShowNotesOnLogin) { @@ -116,9 +113,9 @@ class CNotesMod : public CModule { } else if (sLine.Left(2) == "#-") { sKey = sLine.Token(0).LeftChomp_n(2); if (DelNote(sKey)) { - PutModNotice("Deleted note [" + sKey + "]"); + PutModNotice(t_f("Deleted note {1}")(sKey)); } else { - PutModNotice("Unable to delete note [" + sKey + "]"); + PutModNotice(t_f("Unable to delete note {1}")(sKey)); } return HALT; } else if (sLine.Left(2) == "#+") { @@ -133,16 +130,16 @@ class CNotesMod : public CModule { if (!sKey.empty()) { if (!bOverwrite && FindNV(sKey) != EndNV()) { PutModNotice( - "That note already exists. Use /#+ to " - "overwrite."); + t_s("That note already exists. Use /#+ to " + "overwrite.")); } else if (AddNote(sKey, sValue)) { if (!bOverwrite) { - PutModNotice("Added note [" + sKey + "]"); + PutModNotice(t_f("Added note {1}")(sKey)); } else { - PutModNotice("Set note for [" + sKey + "]"); + PutModNotice(t_f("Set note for {1}")(sKey)); } } else { - PutModNotice("Unable to add note [" + sKey + "]"); + PutModNotice(t_f("Unable to add note {1}")(sKey)); } } @@ -164,13 +161,13 @@ class CNotesMod : public CModule { if (pClient) { CTable Table; - Table.AddColumn("Key"); - Table.AddColumn("Note"); + Table.AddColumn(t_s("Key")); + Table.AddColumn(t_s("Note")); for (MCString::iterator it = BeginNV(); it != EndNV(); ++it) { Table.AddRow(); - Table.SetCell("Key", it->first); - Table.SetCell("Note", it->second); + Table.SetCell(t_s("Key"), it->first); + Table.SetCell(t_s("Note"), it->second); } if (Table.size()) { @@ -185,9 +182,9 @@ class CNotesMod : public CModule { } } else { if (bNotice) { - PutModNotice("You have no entries."); + PutModNotice(t_s("You have no entries.")); } else { - PutModule("You have no entries."); + PutModule(t_s("You have no entries.")); } } } @@ -223,8 +220,8 @@ void TModInfo(CModInfo& Info) { Info.SetWikiPage("notes"); Info.SetHasArgs(true); Info.SetArgsHelpText( - "This user module takes up to one arguments. It can be " - "-disableNotesOnLogin not to show notes upon client login"); + Info.t_s("This user module takes up to one arguments. It can be " + "-disableNotesOnLogin not to show notes upon client login")); } -USERMODULEDEFS(CNotesMod, "Keep and replay notes") +USERMODULEDEFS(CNotesMod, t_s("Keep and replay notes")) diff --git a/modules/notify_connect.cpp b/modules/notify_connect.cpp index c78bc6a5..9f0a4d54 100644 --- a/modules/notify_connect.cpp +++ b/modules/notify_connect.cpp @@ -21,9 +21,9 @@ class CNotifyConnectMod : public CModule { public: MODCONSTRUCTOR(CNotifyConnectMod) {} - void OnClientLogin() override { NotifyAdmins("attached"); } + void OnClientLogin() override { NotifyAdmins(t_s("attached")); } - void OnClientDisconnect() override { NotifyAdmins("detached"); } + void OnClientDisconnect() override { NotifyAdmins(t_s("detached")); } private: void SendAdmins(const CString& msg) { @@ -38,7 +38,7 @@ class CNotifyConnectMod : public CModule { } CString ip = GetClient()->GetRemoteIP(); - SendAdmins(client + " " + event + " (from " + ip + ")"); + SendAdmins(t_f("{1} {2} from {3}")(client, event, ip)); } }; @@ -49,4 +49,4 @@ void TModInfo(CModInfo& Info) { GLOBALMODULEDEFS( CNotifyConnectMod, - "Notifies all admin users when a client connects or disconnects.") + t_s("Notifies all admin users when a client connects or disconnects.")) diff --git a/modules/partyline.cpp b/modules/partyline.cpp index ee88b9ca..2d832a4e 100644 --- a/modules/partyline.cpp +++ b/modules/partyline.cpp @@ -57,21 +57,21 @@ class CPartylineMod : public CModule { public: void ListChannelsCommand(const CString& sLine) { if (m_ssChannels.empty()) { - PutModule("There are no open channels."); + PutModule(t_s("There are no open channels.")); return; } CTable Table; - Table.AddColumn("Channel"); - Table.AddColumn("Users"); + Table.AddColumn(t_s("Channel")); + Table.AddColumn(t_s("Users")); for (set::const_iterator a = m_ssChannels.begin(); a != m_ssChannels.end(); ++a) { Table.AddRow(); - Table.SetCell("Channel", (*a)->GetName()); - Table.SetCell("Users", CString((*a)->GetNicks().size())); + Table.SetCell(t_s("Channel"), (*a)->GetName()); + Table.SetCell(t_s("Users"), CString((*a)->GetNicks().size())); } PutModule(Table); @@ -79,9 +79,8 @@ class CPartylineMod : public CModule { MODCONSTRUCTOR(CPartylineMod) { AddHelpCommand(); - AddCommand("List", static_cast( - &CPartylineMod::ListChannelsCommand), - "", "List all open channels"); + AddCommand("List", "", t_d("List all open channels"), + [=](const CString& sLine) { ListChannelsCommand(sLine); }); } ~CPartylineMod() override { @@ -733,9 +732,10 @@ void TModInfo(CModInfo& Info) { Info.SetWikiPage("partyline"); Info.SetHasArgs(true); Info.SetArgsHelpText( - "You may enter a list of channels the user joins, when entering the " - "internal partyline."); + Info.t_s("You may enter a list of channels the user joins, when " + "entering the internal partyline.")); } -GLOBALMODULEDEFS(CPartylineMod, - "Internal channels and queries for users connected to znc") +GLOBALMODULEDEFS( + CPartylineMod, + t_s("Internal channels and queries for users connected to ZNC")) diff --git a/modules/perform.cpp b/modules/perform.cpp index 011b5bd6..c4931ba9 100644 --- a/modules/perform.cpp +++ b/modules/perform.cpp @@ -21,12 +21,12 @@ class CPerform : public CModule { CString sPerf = sCommand.Token(1, true); if (sPerf.empty()) { - PutModule("Usage: add "); + PutModule(t_s("Usage: add ")); return; } m_vPerform.push_back(ParsePerform(sPerf)); - PutModule("Added!"); + PutModule(t_s("Added!")); Save(); } @@ -34,11 +34,11 @@ class CPerform : public CModule { u_int iNum = sCommand.Token(1, true).ToUInt(); if (iNum > m_vPerform.size() || iNum <= 0) { - PutModule("Illegal # Requested"); + PutModule(t_s("Illegal # Requested")); return; } else { m_vPerform.erase(m_vPerform.begin() + iNum - 1); - PutModule("Command Erased."); + PutModule(t_s("Command Erased.")); } Save(); } @@ -47,30 +47,30 @@ class CPerform : public CModule { CTable Table; unsigned int index = 1; - Table.AddColumn("Id"); - Table.AddColumn("Perform"); - Table.AddColumn("Expanded"); + Table.AddColumn(t_s("Id", "list")); + Table.AddColumn(t_s("Perform", "list")); + Table.AddColumn(t_s("Expanded", "list")); for (const CString& sPerf : m_vPerform) { Table.AddRow(); - Table.SetCell("Id", CString(index++)); - Table.SetCell("Perform", sPerf); + Table.SetCell(t_s("Id", "list"), CString(index++)); + Table.SetCell(t_s("Perform", "list"), sPerf); CString sExpanded = ExpandString(sPerf); if (sExpanded != sPerf) { - Table.SetCell("Expanded", sExpanded); + Table.SetCell(t_s("Expanded", "list"), sExpanded); } } if (PutModule(Table) == 0) { - PutModule("No commands in your perform list."); + PutModule(t_s("No commands in your perform list.")); } } void Execute(const CString& sCommand) { OnIRCConnected(); - PutModule("perform commands sent"); + PutModule(t_s("perform commands sent")); } void Swap(const CString& sCommand) { @@ -79,11 +79,11 @@ class CPerform : public CModule { if (iNumA > m_vPerform.size() || iNumA <= 0 || iNumB > m_vPerform.size() || iNumB <= 0) { - PutModule("Illegal # Requested"); + PutModule(t_s("Illegal # Requested")); } else { std::iter_swap(m_vPerform.begin() + (iNumA - 1), m_vPerform.begin() + (iNumB - 1)); - PutModule("Commands Swapped."); + PutModule(t_s("Commands Swapped.")); Save(); } } @@ -91,20 +91,20 @@ class CPerform : public CModule { public: MODCONSTRUCTOR(CPerform) { AddHelpCommand(); - AddCommand("Add", static_cast(&CPerform::Add), - "", - "Adds perform command to be sent to the server on connect"); - AddCommand("Del", static_cast(&CPerform::Del), - "", "Delete a perform command"); - AddCommand("List", - static_cast(&CPerform::List), "", - "List the perform commands"); - AddCommand("Execute", - static_cast(&CPerform::Execute), "", - "Send the perform commands to the server now"); - AddCommand("Swap", - static_cast(&CPerform::Swap), - " ", "Swap two perform commands"); + AddCommand( + "Add", t_d(""), + t_d("Adds perform command to be sent to the server on connect"), + [=](const CString& sLine) { Add(sLine); }); + AddCommand("Del", t_d(""), t_d("Delete a perform command"), + [=](const CString& sLine) { Del(sLine); }); + AddCommand("List", "", t_d("List the perform commands"), + [=](const CString& sLine) { List(sLine); }); + AddCommand("Execute", "", + t_d("Send the perform commands to the server now"), + [=](const CString& sLine) { Execute(sLine); }); + AddCommand("Swap", t_d(" "), + t_d("Swap two perform commands"), + [=](const CString& sLine) { Swap(sLine); }); } ~CPerform() override {} @@ -140,7 +140,7 @@ class CPerform : public CModule { } } - CString GetWebMenuTitle() override { return "Perform"; } + CString GetWebMenuTitle() override { return t_s("Perform"); } bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) override { @@ -189,4 +189,4 @@ void TModInfo(CModInfo& Info) { NETWORKMODULEDEFS( CPerform, - "Keeps a list of commands to be executed when ZNC connects to IRC.") + t_s("Keeps a list of commands to be executed when ZNC connects to IRC."))
KeyNote
[del]<? FORMAT " />