From 65a1e9296ef70197966da244a3aff300265f580f Mon Sep 17 00:00:00 2001 From: Hugo Posnic Date: Wed, 21 Dec 2016 18:32:16 +0100 Subject: [PATCH] Catch error if locale's file not installed --- src/manjaro_hello.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/manjaro_hello.py b/src/manjaro_hello.py index 2a410f5..1cbc92f 100644 --- a/src/manjaro_hello.py +++ b/src/manjaro_hello.py @@ -120,8 +120,11 @@ class ManjaroHello(): :param locale: locale to use :type locale: str """ - tr = gettext.translation(self.app, self.locale_path, [locale]) - tr.install() + try: + tr = gettext.translation(self.app, self.locale_path, [locale]) + tr.install() + except OSError: + print("WARNING: No translation file for '{}' locale".format(locale)) # Dirty code to fix an issue with gettext that can't translate strings from glade files # Redfining all translatables strings