mirror of
https://github.com/anope/anope.git
synced 2026-07-10 00:33:11 +02:00
Various improvements to the timezone list.
- Correctly translate the time region message. - Squash time regions with only one zone like Antactica into Misc. - Make sure we use a comma in the zone list even at the end of a line.
This commit is contained in:
@@ -16,8 +16,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Anope\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-07-09 18:57+0100\n"
|
||||
"PO-Revision-Date: 2026-07-09 18:57+0100\n"
|
||||
"POT-Creation-Date: 2026-07-09 21:01+0100\n"
|
||||
"PO-Revision-Date: 2026-07-09 21:02+0100\n"
|
||||
"Last-Translator: Sadie Powell <sadie@sadiepowell.dev>\n"
|
||||
"Language-Team: English\n"
|
||||
"Language: en_US\n"
|
||||
@@ -1019,6 +1019,13 @@ msgstr ""
|
||||
msgid "user [reason]"
|
||||
msgstr ""
|
||||
|
||||
#: ../modules/nickserv/ns_set_timezone.cpp
|
||||
#, c-format
|
||||
msgid " %s (%zu timezone)"
|
||||
msgid_plural " %s (%zu timezones)"
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#: ../modules/operserv/os_oper.cpp
|
||||
#, c-format
|
||||
msgid " %s is online using this oper block."
|
||||
|
||||
@@ -56,8 +56,10 @@ protected:
|
||||
buffer.clear();
|
||||
}
|
||||
|
||||
buffer.append(buffer.empty() ? " " : ", ");
|
||||
buffer.append(timezone);
|
||||
buffer
|
||||
.append(buffer.empty() ? " " : " ")
|
||||
.append(timezone)
|
||||
.append(",");
|
||||
}
|
||||
|
||||
if (!buffer.empty())
|
||||
@@ -156,7 +158,10 @@ public:
|
||||
));
|
||||
|
||||
for (const auto &[timeregion, timezone] : timeregions)
|
||||
source.Reply(" %s (%zu timezones)", timeregion.c_str(), timezone.size());
|
||||
{
|
||||
source.Reply(timezone.size(), N_(" %s (%zu timezone)", " %s (%zu timezones)"),
|
||||
timeregion.c_str(), timezone.size());
|
||||
}
|
||||
|
||||
source.Reply(_("Type \002%s\033\037region\037\002 to list timezones for a region."),
|
||||
source.service->GetQueryCommand("generic/help", source.command).c_str());
|
||||
@@ -244,8 +249,24 @@ public:
|
||||
auto region = tzsep == Anope::string::npos ? "Misc" : timezone.substr(0, tzsep);
|
||||
timeregions[region].push_back(timezone);
|
||||
}
|
||||
for (auto &[_, timeregion] : timeregions)
|
||||
std::sort(timeregion.begin(), timeregion.end());
|
||||
|
||||
// Eliminate regions with only one timezone.
|
||||
for (auto it = timeregions.begin(); it != timeregions.end(); )
|
||||
{
|
||||
const auto &[timeregion, timezones] = *it;
|
||||
if (!timeregion.equals_ci("Misc") && timezones.size() < 2)
|
||||
{
|
||||
auto& miscregion = timeregions["Misc"];
|
||||
miscregion.insert(miscregion.end(), timezones.begin(), timezones.end());
|
||||
it = timeregions.erase(it);
|
||||
continue;
|
||||
}
|
||||
it++;
|
||||
}
|
||||
|
||||
// Ensure the timezone list is ordered alphabetically.
|
||||
for (auto &[_, timezones] : timeregions)
|
||||
std::sort(timezones.begin(), timezones.end());
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user