From 474da059297f3fb15e3aaf1209c52976aa7107f7 Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Mon, 7 Aug 2017 18:32:02 +0200 Subject: [PATCH] [modules/datetime] Simplify locale logic see #156 --- bumblebee/modules/datetime.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/bumblebee/modules/datetime.py b/bumblebee/modules/datetime.py index 533261a..74fae8b 100644 --- a/bumblebee/modules/datetime.py +++ b/bumblebee/modules/datetime.py @@ -31,15 +31,8 @@ class Module(bumblebee.engine.Module): super(Module, self).__init__(engine, config, bumblebee.output.Widget(full_text=self.get_time)) self._fmt = self.parameter("format", default_format(self.name)) - lcl = self.parameter("locale") - - # can't use the default in "parameter" because we split the - # string, while 'getdefaultlocale' already returns a tuple - if lcl is None: - self._lcl = locale.getdefaultlocale() - else: - self._lcl = lcl.split(".") - locale.setlocale(locale.LC_TIME, self._lcl) + lcl = self.parameter("locale", ".".join(locale.getdefaultlocale())) + locale.setlocale(locale.LC_TIME, lcl.split(".")) def get_time(self, widget): return datetime.datetime.now().strftime(self._fmt)