More translateable strings, #1354

This commit is contained in:
Alexey Sokolov
2017-09-06 00:01:37 +01:00
parent b516d40d65
commit 408e6e9f01
2 changed files with 32 additions and 36 deletions
+17 -19
View File
@@ -36,15 +36,13 @@ class CKeepNickMod : public CModule {
public:
MODCONSTRUCTOR(CKeepNickMod) {
AddHelpCommand();
AddCommand("Enable", static_cast<CModCommand::ModCmdFunc>(
&CKeepNickMod::OnEnableCommand),
"", "Try to get your primary nick");
AddCommand("Disable", static_cast<CModCommand::ModCmdFunc>(
&CKeepNickMod::OnDisableCommand),
"", "No longer trying to get your primary nick");
AddCommand("State", static_cast<CModCommand::ModCmdFunc>(
&CKeepNickMod::OnStateCommand),
"", "Show the current state");
AddCommand("Enable", "", t_d("Try to get your primary nick"),
[=](const CString& sLine) { OnEnableCommand(sLine); });
AddCommand("Disable", "",
t_d("No longer trying to get your primary nick"),
[=](const CString& sLine) { OnDisableCommand(sLine); });
AddCommand("State", "", t_d("Show the current state"),
[=](const CString& sLine) { OnStateCommand(sLine); });
}
~CKeepNickMod() override {}
@@ -158,8 +156,8 @@ class CKeepNickMod : public CModule {
// Indeed trying to change to this nick, generate a 433 for it.
// This way we can *always* block incoming 433s from the server.
PutUser(":" + GetNetwork()->GetIRCServer() + " 433 " +
GetNetwork()->GetIRCNick().GetNick() + " " + sNick +
" :ZNC is already trying to get this nickname");
GetNetwork()->GetIRCNick().GetNick() + " " + sNick + " :" +
t_s("ZNC is already trying to get this nickname"));
return CONTINUE;
}
@@ -174,15 +172,15 @@ class CKeepNickMod : public CModule {
// :leguin.freenode.net 435 mynick badnick #chan :Cannot change nickname while banned on channel
// clang-format on
if (msg.GetCode() == 435) {
PutModule("Unable to obtain nick " + msg.GetParam(1) + ": " +
msg.GetParam(3) + ", " + msg.GetParam(2));
PutModule(t_f("Unable to obtain nick {1}: {2}, {3}")(
msg.GetParam(1), msg.GetParam(3), msg.GetParam(2)));
Disable();
}
// clang-format off
// :irc1.unrealircd.org 447 mynick :Can not change nickname while on #chan (+N)
// clang-format on
if (msg.GetCode() == 447) {
PutModule("Unable to obtain nick: " + msg.GetParam(1));
PutModule(t_f("Unable to obtain nick {1}")(msg.GetParam(1)));
Disable();
}
}
@@ -192,19 +190,19 @@ class CKeepNickMod : public CModule {
void OnEnableCommand(const CString& sCommand) {
Enable();
PutModule("Trying to get your primary nick");
PutModule(t_s("Trying to get your primary nick"));
}
void OnDisableCommand(const CString& sCommand) {
Disable();
PutModule("No longer trying to get your primary nick");
PutModule(t_s("No longer trying to get your primary nick"));
}
void OnStateCommand(const CString& sCommand) {
if (m_pTimer)
PutModule("Currently trying to get your primary nick");
PutModule(t_s("Currently trying to get your primary nick"));
else
PutModule("Currently disabled, try 'enable'");
PutModule(t_s("Currently disabled, try 'enable'"));
}
private:
@@ -225,4 +223,4 @@ void TModInfo<CKeepNickMod>(CModInfo& Info) {
Info.SetWikiPage("keepnick");
}
NETWORKMODULEDEFS(CKeepNickMod, "Keep trying for your primary nick")
NETWORKMODULEDEFS(CKeepNickMod, t_s("Keeps trying for your primary nick"))
+15 -17
View File
@@ -53,12 +53,10 @@ class CRejoinMod : public CModule {
public:
MODCONSTRUCTOR(CRejoinMod) {
AddHelpCommand();
AddCommand("SetDelay", static_cast<CModCommand::ModCmdFunc>(
&CRejoinMod::OnSetDelayCommand),
"<secs>", "Set the rejoin delay");
AddCommand("ShowDelay", static_cast<CModCommand::ModCmdFunc>(
&CRejoinMod::OnShowDelayCommand),
"", "Show the rejoin delay");
AddCommand("SetDelay", t_d("<secs>"), t_d("Set the rejoin delay"),
[=](const CString& sLine) { OnSetDelayCommand(sLine); });
AddCommand("ShowDelay", "", t_d("Show the rejoin delay"),
[=](const CString& sLine) { OnShowDelayCommand(sLine); });
}
~CRejoinMod() override {}
@@ -75,9 +73,7 @@ class CRejoinMod : public CModule {
if ((i == 0 && sArgs == "0") || i > 0)
delay = i;
else {
sErrorMsg =
"Illegal argument, "
"must be a positive number or 0";
sErrorMsg = "Illegal argument, must be a positive number or 0";
return false;
}
}
@@ -90,7 +86,7 @@ class CRejoinMod : public CModule {
i = sCommand.Token(1).ToInt();
if (i < 0) {
PutModule("Negative delays don't make any sense!");
PutModule(t_s("Negative delays don't make any sense!"));
return;
}
@@ -98,16 +94,18 @@ class CRejoinMod : public CModule {
SetNV("delay", CString(delay));
if (delay)
PutModule("Rejoin delay set to " + CString(delay) + " seconds");
PutModule(t_p("Rejoin delay set to 1 second",
"Rejoin delay set to {1} seconds", delay)(delay));
else
PutModule("Rejoin delay disabled");
PutModule(t_s("Rejoin delay disabled"));
}
void OnShowDelayCommand(const CString& sCommand) {
if (delay)
PutModule("Rejoin delay enabled, " + CString(delay) + " seconds");
PutModule(t_p("Rejoin delay is set to 1 second",
"Rejoin delay is set to {1} seconds", delay)(delay));
else
PutModule("Rejoin delay disabled");
PutModule(t_s("Rejoin delay is disabled"));
}
void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& pChan,
@@ -128,8 +126,8 @@ template <>
void TModInfo<CRejoinMod>(CModInfo& Info) {
Info.SetWikiPage("kickrejoin");
Info.SetHasArgs(true);
Info.SetArgsHelpText(
"You might enter the number of seconds to wait before rejoining.");
Info.SetArgsHelpText(Info.t_s(
"You might enter the number of seconds to wait before rejoining."));
}
NETWORKMODULEDEFS(CRejoinMod, "Autorejoin on kick")
NETWORKMODULEDEFS(CRejoinMod, t_s("Autorejoins on kick"))