1
0
mirror of https://github.com/anope/anope.git synced 2026-06-27 12:36:38 +02:00

Fix translating examples.

This commit is contained in:
Sadie Powell
2026-02-25 15:56:58 +00:00
parent 9409560597
commit decbab5d09
+8 -6
View File
@@ -340,22 +340,24 @@ void ExampleWrapper::SendTo(CommandSource &source)
header = false;
}
const auto *trans_command = Language::Translate(source.nc, source.command.c_str());
const auto *trans_description = Language::Translate(source.nc, entry.description.c_str());
if (flexible)
{
source.Reply("\002%s%s%s\002: %s", source.command.c_str(), entry.example.empty() ? "" : " ",
entry.example.c_str(), entry.description.c_str());
source.Reply("\002%s%s%s\002: %s", source.command.c_str(), *trans_command ? " " : "",
trans_command, trans_description);
}
else
{
source.Reply(" ");
const auto full_example = Anope::Format("%s%s%s", source.command.c_str(),
entry.example.empty() ? "" : " ", entry.example.c_str());
const auto full_command = Anope::Format("%s%s%s", source.command.c_str(),
*trans_command ? " " : "", trans_command);
LineWrapper elw(Language::Translate(source.nc, full_example.c_str()), max_length - 2);
LineWrapper elw(full_command, max_length - 2);
for (Anope::string line; elw.GetLine(line); )
source.Reply("%s \002%s\002", monospace, line.c_str());
LineWrapper dlw(Language::Translate(source.nc, entry.description.c_str()), max_length - 4);
LineWrapper dlw(trans_description, max_length - 4);
for (Anope::string line; dlw.GetLine(line); )
source.Reply("%s %s", monospace, line.c_str());
}