fix(date): Use configured locale if defined

Fixes jaagr/lemonbuddy#74
This commit is contained in:
Michael Carlberg 2016-10-12 16:48:14 +02:00
parent e42eb87177
commit 789345291b
3 changed files with 6 additions and 0 deletions

View File

@ -206,6 +206,7 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose> {
// Set misc parameters {{{
m_bar.separator = string_util::trim(m_conf.get<string>(bs, "separator", ""), '"');
m_bar.locale = m_conf.get<string>(bs, "locale", "");
// }}}
// Checking nodraw {{{

View File

@ -16,6 +16,8 @@ enum class gc { NONE = 0, BG, FG, OL, UL, BT, BB, BL, BR };
struct bar_settings {
bar_settings() = default;
string locale;
int16_t x{0};
int16_t y{0};
uint16_t width{0};

View File

@ -10,6 +10,9 @@ namespace modules {
using timer_module::timer_module;
void setup() {
if (!m_bar.locale.empty())
setlocale(LC_TIME, m_bar.locale.c_str());
m_interval = chrono::duration<double>(m_conf.get<float>(name(), "interval", 1));
m_formatter->add(DEFAULT_FORMAT, TAG_DATE, {TAG_DATE});