[modules/datetime] Fall back to en_US.UTF-8
If no default locale is available, fall back to en_US.UTF-8. see #159
This commit is contained in:
parent
be20a36805
commit
cb3a7b826b
1 changed files with 4 additions and 1 deletions
|
@ -31,7 +31,10 @@ 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))
|
||||||
lcl = self.parameter("locale", ".".join(locale.getdefaultlocale()))
|
l = locale.getdefaultlocale()
|
||||||
|
if not l:
|
||||||
|
l = ('en_US', 'UTF-8')
|
||||||
|
lcl = self.parameter("locale", ".".join(l))
|
||||||
locale.setlocale(locale.LC_TIME, lcl.split("."))
|
locale.setlocale(locale.LC_TIME, lcl.split("."))
|
||||||
|
|
||||||
def get_time(self, widget):
|
def get_time(self, widget):
|
||||||
|
|
Loading…
Reference in a new issue