Issue#1552. Calendar module, LC_TIME variable
parent
7b7ee41e13
commit
448b413eca
|
@ -66,18 +66,13 @@ waybar::modules::Clock::Clock(const std::string& id, const Json::Value& config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config_["locale"].isString()) {
|
const char* applyLocale{config_["locale"].isString() ? config_["locale"].asCString() : getenv("LC_TIME")};
|
||||||
locale_ = std::locale(config_["locale"].asString());
|
|
||||||
} else {
|
|
||||||
char* sysLocale{getenv("LC_TIME")};
|
|
||||||
try {
|
try {
|
||||||
locale_ = sysLocale ? std::locale(sysLocale) : std::locale("");
|
locale_ = applyLocale ? std::locale(applyLocale) : std::locale("");
|
||||||
}
|
} catch(std::runtime_error const& localeE) {
|
||||||
catch(std::runtime_error const& localeErr) {
|
spdlog::warn("Clock module. Wrong \"locale\" or LC_TIME variable(make sure locale is presented in /etc/locale.gen and generated by the locale-gen). Trace: {0}", localeE.what());
|
||||||
spdlog::warn(localeErr.what());
|
|
||||||
locale_ = std::locale();
|
locale_ = std::locale();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
thread_ = [this] {
|
thread_ = [this] {
|
||||||
dp.emit();
|
dp.emit();
|
||||||
|
|
Loading…
Reference in New Issue