Skip to content

Commit

Permalink
[modules/datetime] Simplify locale logic
Browse files Browse the repository at this point in the history
see #156
  • Loading branch information
tobi-wan-kenobi committed Aug 7, 2017
1 parent 17204dd commit 474da05
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions bumblebee/modules/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,8 @@ def __init__(self, engine, config):
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)
Expand Down

0 comments on commit 474da05

Please sign in to comment.