Calendar module: localization issue #1552
This commit is contained in:
Alex 2022-05-23 13:40:48 +02:00 committed by GitHub
commit 38a846ae51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -230,12 +230,14 @@ auto waybar::modules::Clock::calendar_text(const waybar_time& wtime) -> std::str
} else
os << date::format("%e", d);
/*Print weeks on the right when the endings with spaces*/
if (ws == 2 && d == last_day && wd.c_encoding() < 6) {
empty_days = 6 - wd.c_encoding();
if (ws == 2 && d == last_day) {
empty_days = 6 - (wd.c_encoding() - first_dow.c_encoding());
if (empty_days > 0) {
os << std::string(empty_days * 3 + 1, ' ');
print_iso_weeknum(os, wn);
}
}
}
auto result = os.str();
cached_calendar_ymd_ = ymd;
@ -291,7 +293,7 @@ auto waybar::modules::Clock::timezones_text(std::chrono::system_clock::time_poin
auto waybar::modules::Clock::print_iso_weeknum(std::ostream& os, int weeknum) -> void {
std::stringstream res;
res << 'W' << std::setfill('0') << std::setw(2) << weeknum;
res << std::setfill('0') << std::setw(2) << weeknum;
if (config_["format-calendar-weeks"].isString()) {
os << fmt::format(config_["format-calendar-weeks"].asString(), res.str());