[module/datetime] Fix case when no locale is set
This commit is contained in:
parent
aa9941ceda
commit
7e1e020443
1 changed files with 4 additions and 2 deletions
|
@ -31,12 +31,14 @@ class Module(bumblebee.engine.Module):
|
||||||
super(Module, self).__init__(engine, config,
|
super(Module, self).__init__(engine, config,
|
||||||
bumblebee.output.Widget(full_text=self.get_time))
|
bumblebee.output.Widget(full_text=self.get_time))
|
||||||
self._fmt = self.parameter("format", default_format(self.name))
|
self._fmt = self.parameter("format", default_format(self.name))
|
||||||
self._lcl = self.parameter("locale").split(".")
|
lcl = self.parameter("locale")
|
||||||
|
|
||||||
# can't use the default in "parameter" because we split the
|
# can't use the default in "parameter" because we split the
|
||||||
# string, while 'getdefaultlocale' already returns a tuple
|
# string, while 'getdefaultlocale' already returns a tuple
|
||||||
if self._lcl is None:
|
if lcl is None:
|
||||||
self._lcl = locale.getdefaultlocale()
|
self._lcl = locale.getdefaultlocale()
|
||||||
|
else:
|
||||||
|
self._lcl = lcl.split(".")
|
||||||
locale.setlocale(locale.LC_TIME, self._lcl)
|
locale.setlocale(locale.LC_TIME, self._lcl)
|
||||||
|
|
||||||
def get_time(self, widget):
|
def get_time(self, widget):
|
||||||
|
|
Loading…
Reference in a new issue