mirror of
https://github.com/anope/anope.git
synced 2026-06-12 19:34:48 +02:00
Add a plural form overload of CommandSource::Reply.
This commit is contained in:
@@ -81,6 +81,7 @@ public:
|
||||
bool IsFounder(ChannelInfo *ci);
|
||||
|
||||
void Reply(const char *message, ...) ATTR_FORMAT(2, 3);
|
||||
void Reply(int count, const char *singular, const char *plural, ...) ATTR_FORMAT(4, 5);
|
||||
void Reply(const Anope::string &message);
|
||||
|
||||
bool HasCommand(const Anope::string &cmd);
|
||||
|
||||
+13
-9
@@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Anope\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-11-19 16:54+0000\n"
|
||||
"POT-Creation-Date: 2024-11-19 17:06+0000\n"
|
||||
"PO-Revision-Date: 2024-11-13 02:45+0000\n"
|
||||
"Last-Translator: Sadie Powell <sadie@witchery.services>\n"
|
||||
"Language-Team: English\n"
|
||||
@@ -22,10 +22,6 @@ msgstr ""
|
||||
msgid "%d channel(s) cleared, and %d channel(s) dropped."
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%d nickname(s) dropped."
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s added to %s %s list."
|
||||
msgstr ""
|
||||
@@ -354,6 +350,12 @@ msgstr ""
|
||||
msgid "%s HELP %s for more information."
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "1 nickname dropped."
|
||||
msgid_plural "%d nicknames dropped."
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
msgid "ADD nick user host real"
|
||||
msgstr ""
|
||||
|
||||
@@ -1361,10 +1363,6 @@ msgstr ""
|
||||
msgid "%s's memo limit is %d."
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%zu nickname(s) in the group."
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "(%s ago)"
|
||||
msgstr ""
|
||||
@@ -1453,6 +1451,12 @@ msgid_plural "%lld minutes"
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#, c-format
|
||||
msgid "1 nickname in the group."
|
||||
msgid_plural "%zu nicknames in the group."
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#, c-format
|
||||
msgid "1 second"
|
||||
msgid_plural "%lld seconds"
|
||||
|
||||
@@ -359,7 +359,7 @@ public:
|
||||
for (const auto &reply : replies)
|
||||
source.Reply(reply);
|
||||
|
||||
source.Reply(_("%zu nickname(s) in the group."), nc->aliases->size());
|
||||
source.Reply(nc->aliases->size(), N_("1 nickname in the group.", "%zu nicknames in the group."), nc->aliases->size());
|
||||
}
|
||||
|
||||
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
|
||||
|
||||
@@ -292,7 +292,7 @@ public:
|
||||
delete na;
|
||||
}
|
||||
|
||||
source.Reply(_("\002%d\002 nickname(s) dropped."), na_matches);
|
||||
source.Reply(na_matches, N_("\0021\002 nickname dropped.", "\002%d\002 nicknames dropped."), na_matches);
|
||||
break;
|
||||
}
|
||||
case FT_CHAN:
|
||||
|
||||
@@ -118,6 +118,21 @@ void CommandSource::Reply(const char *message, ...)
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void CommandSource::Reply(int count, const char *single, const char *plural, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buf[4096]; // Messages can be really big.
|
||||
|
||||
const char *translated_message = Language::Translate(this->nc, count, single, plural);
|
||||
|
||||
va_start(args, plural);
|
||||
vsnprintf(buf, sizeof(buf), translated_message, args);
|
||||
|
||||
this->Reply(Anope::string(buf));
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void CommandSource::Reply(const Anope::string &message)
|
||||
{
|
||||
const char *translated_message = Language::Translate(this->nc, message.c_str());
|
||||
|
||||
Reference in New Issue
Block a user