mirror of
https://github.com/anope/anope.git
synced 2026-07-03 12:43:12 +02:00
Add a plural form overload of SendMessage.
This commit is contained in:
@@ -190,6 +190,7 @@ public:
|
||||
* @param ... any number of parameters
|
||||
*/
|
||||
void SendMessage(BotInfo *source, const char *fmt, ...) ATTR_FORMAT(3, 4);
|
||||
void SendMessage(BotInfo *source, int count, const char *singular, const char *plural, ...) ATTR_FORMAT(5, 6);
|
||||
void SendMessage(BotInfo *source, const Anope::string &msg) override;
|
||||
void SendMessage(CommandSource &source, const Anope::string &msg) override;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Anope\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-11-22 13:00+0000\n"
|
||||
"POT-Creation-Date: 2024-11-22 15:21+0000\n"
|
||||
"PO-Revision-Date: 2024-11-13 02:45+0000\n"
|
||||
"Last-Translator: Sadie Powell <sadie@witchery.services>\n"
|
||||
"Language-Team: English\n"
|
||||
@@ -6986,11 +6986,10 @@ msgid "You found me, %s!"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "You have %d new memos."
|
||||
msgstr ""
|
||||
|
||||
msgid "You have 1 new memo."
|
||||
msgstr ""
|
||||
msgid_plural "You have %d new memos."
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
if (nc->memos.GetMemo(i)->unread)
|
||||
++newcnt;
|
||||
if (newcnt > 0)
|
||||
u->SendMessage(MemoServ, newcnt == 1 ? _("You have 1 new memo.") : _("You have %d new memos."), newcnt);
|
||||
u->SendMessage(MemoServ, newcnt, N_("You have 1 new memo.", "You have %d new memos."), newcnt);
|
||||
if (nc->memos.memomax > 0 && nc->memos.memos->size() >= static_cast<unsigned>(nc->memos.memomax))
|
||||
{
|
||||
if (nc->memos.memos->size() > static_cast<unsigned>(nc->memos.memomax))
|
||||
|
||||
@@ -328,6 +328,21 @@ void User::SendMessage(BotInfo *source, const char *fmt, ...)
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void User::SendMessage(BotInfo *source, int count, const char *singular, const char *plural, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buf[BUFSIZE] = "";
|
||||
|
||||
const char *translated_message = Language::Translate(this, count, singular, plural);
|
||||
|
||||
va_start(args, plural);
|
||||
vsnprintf(buf, BUFSIZE - 1, translated_message, args);
|
||||
|
||||
this->SendMessage(source, Anope::string(buf));
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
void SendMessageInternal(BotInfo *source, User *target, const Anope::string &msg, const Anope::map<Anope::string> &tags)
|
||||
|
||||
Reference in New Issue
Block a user