More translatable strings, #1354

This commit is contained in:
Alexey Sokolov
2017-10-22 23:13:31 +01:00
parent 615d4f6b5e
commit 05a0cbf3e0
7 changed files with 122 additions and 124 deletions
+9 -8
View File
@@ -1,21 +1,22 @@
<? I18N znc-notes ?>
<? INC Header.tmpl ?>
<form method="post" action="<? VAR URIPrefix TOP ?><? VAR ModPath ?>addnote">
<? INC _csrf_check.tmpl ?>
<div class="section">
<h3>Add A Note</h3>
<h3><? FORMAT "Add A Note" ?></h3>
<div class="sectionbg">
<div class="sectionbody">
<div class="subsection third">
<div class="inputlabel">Key:</div>
<div class="inputlabel"><? FORMAT "Key:" ?></div>
<input type="text" name="key" size="8" />
</div>
<div class="subsection full">
<div class="inputlabel">Note:</div>
<div class="inputlabel"><? FORMAT "Note:" ?></div>
<input type="text" name="note" size="40" />
</div>
<div class="subsection submitline">
<input type="submit" name="add" value="Add Note" />
<input type="submit" name="add" value="<? FORMAT "Add Note" ?>" />
</div>
</div>
</div>
@@ -23,21 +24,21 @@
</form>
<? IF !NotesLoop ?>
<p>You have no notes to display.</p>
<p><? FORMAT "You have no notes to display." ?></p>
<? ELSE ?>
<table class="data">
<thead>
<tr>
<th style="width: 10px;"></th>
<th>Key</th>
<th>Note</th>
<th><? FORMAT "Key" ?></th>
<th><? FORMAT "Note" ?></th>
</tr>
</thead>
<tbody>
<? LOOP NotesLoop ?>
<tr class="<? IF __EVEN__ ?>evenrow<? ELSE ?>oddrow<? ENDIF ?>">
<td><a href="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>delnote?key=<? VAR Key ESC=URL,HTML ?>"><img src="<? VAR URIPrefix TOP ?><? VAR ModFilesPath TOP ?>trash.gif" alt="[del]" /></a></td>
<td><a href="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>delnote?key=<? VAR Key ESC=URL,HTML ?>"><img src="<? VAR URIPrefix TOP ?><? VAR ModFilesPath TOP ?>trash.gif" alt="<? FORMAT "[del]" ?>" /></a></td>
<td><? VAR Key ?></td>
<td><? VAR Note ?></td>
</tr>
+5 -4
View File
@@ -1,20 +1,21 @@
<? I18N znc-perform ?>
<? INC Header.tmpl ?>
<form method="post" action="<? VAR URIPrefix TOP ?><? VAR ModPath ?>">
<? INC _csrf_check.tmpl ?>
<div class="section">
<h3>Perform</h3>
<h3><? FORMAT "Perform" ?></h3>
<div class="sectionbg">
<div class="sectionbody">
<div class="subsection full">
<div class="inputlabel">Perform commands:</div>
<div class="inputlabel"><? FORMAT "Perform commands:" ?></div>
<textarea name="perform" cols="70" rows="5" class="monospace"><? LOOP PerformLoop ?><? VAR Perform ?>
<? ENDLOOP ?>
</textarea>
<br /><span class="info">Commands sent to the IRC server on connect, one per line.</span>
<br /><span class="info"><? FORMAT "Commands sent to the IRC server on connect, one per line." ?></span>
</div>
<div class="subsection submitline">
<input type="submit" name="save" value="Save" />
<input type="submit" name="save" value="<? FORMAT "Save" ?>" />
</div>
</div>
</div>
+26 -27
View File
@@ -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<CModCommand::ModCmdFunc>(&CNickServ::SetCommand),
"password");
AddCommand("Clear", static_cast<CModCommand::ModCmdFunc>(
&CNickServ::ClearCommand),
"", "Clear your nickserv password");
AddCommand("SetNSName", static_cast<CModCommand::ModCmdFunc>(
&CNickServ::SetNSNameCommand),
"nickname",
"Set NickServ name (Useful on networks like EpiKnet, where "
"NickServ is named Themis)");
AddCommand("ClearNSName", static_cast<CModCommand::ModCmdFunc>(
&CNickServ::ClearNSNameCommand),
"", "Reset NickServ name to default (NickServ)");
AddCommand("ViewCommands", static_cast<CModCommand::ModCmdFunc>(
&CNickServ::ViewCommandsCommand),
"",
"Show patterns for lines, which are being sent to NickServ");
AddCommand("SetCommand", static_cast<CModCommand::ModCmdFunc>(
&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<CNickServ>(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)"))
+36 -39
View File
@@ -29,12 +29,12 @@ class CNotesMod : public CModule {
if (!GetNV(sKey).empty()) {
PutModule(
"That note already exists. Use MOD <key> <note> to "
"overwrite.");
t_s("That note already exists. Use MOD <key> <note> 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<CModCommand::ModCmdFunc>(
&CNotesMod::ListCommand));
AddCommand("Add", static_cast<CModCommand::ModCmdFunc>(
&CNotesMod::AddNoteCommand),
"<key> <note>");
AddCommand("Del",
static_cast<CModCommand::ModCmdFunc>(&CNotesMod::DelCommand),
"<key>", "Delete a note");
AddCommand("Mod", "<key> <note>", "Modify a note",
std::bind(&CNotesMod::ModCommand, this, _1));
AddCommand("Get", "<key>", "",
[this](const CString& sLine) { GetCommand(sLine); });
AddCommand("List", "", t_d("List notes"),
[=](const CString& sLine) { ListCommand(sLine); });
AddCommand("Add", t_d("<key> <note>"), t_d("Add a note"),
[=](const CString& sLine) { AddNoteCommand(sLine); });
AddCommand("Del", t_d("<key>"), t_d("Delete a note"),
[=](const CString& sLine) { DelCommand(sLine); });
AddCommand("Mod", t_d("<key> <note>"), t_d("Modify a note"),
[=](const CString& sLine) { ModCommand(sLine); });
AddCommand("Get", t_d("<key>"), "",
[=](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 /#+<key> <note> to "
"overwrite.");
t_s("That note already exists. Use /#+<key> <note> 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<CNotesMod>(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"))
+4 -4
View File
@@ -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<CNotifyConnectMod>(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."))
+12 -12
View File
@@ -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<CPartylineChannel*>::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<CModCommand::ModCmdFunc>(
&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<CPartylineMod>(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"))
+30 -30
View File
@@ -21,12 +21,12 @@ class CPerform : public CModule {
CString sPerf = sCommand.Token(1, true);
if (sPerf.empty()) {
PutModule("Usage: add <command>");
PutModule(t_s("Usage: add <command>"));
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<CModCommand::ModCmdFunc>(&CPerform::Add),
"<command>",
"Adds perform command to be sent to the server on connect");
AddCommand("Del", static_cast<CModCommand::ModCmdFunc>(&CPerform::Del),
"<number>", "Delete a perform command");
AddCommand("List",
static_cast<CModCommand::ModCmdFunc>(&CPerform::List), "",
"List the perform commands");
AddCommand("Execute",
static_cast<CModCommand::ModCmdFunc>(&CPerform::Execute), "",
"Send the perform commands to the server now");
AddCommand("Swap",
static_cast<CModCommand::ModCmdFunc>(&CPerform::Swap),
"<number> <number>", "Swap two perform commands");
AddCommand(
"Add", t_d("<command>"),
t_d("Adds perform command to be sent to the server on connect"),
[=](const CString& sLine) { Add(sLine); });
AddCommand("Del", t_d("<number>"), 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("<number> <number>"),
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<CPerform>(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."))