From cb3a7b826b79134444e0d4cc91c58f69029e0554 Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Sun, 21 Jan 2018 08:55:42 +0100 Subject: [PATCH] [modules/datetime] Fall back to en_US.UTF-8 If no default locale is available, fall back to en_US.UTF-8. see #159 --- bumblebee/modules/datetime.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bumblebee/modules/datetime.py b/bumblebee/modules/datetime.py index fe380b4..a46ab67 100644 --- a/bumblebee/modules/datetime.py +++ b/bumblebee/modules/datetime.py @@ -31,7 +31,10 @@ 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", ".".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(".")) def get_time(self, widget):