From 111104047c665b3559691b34de8f3601ddecbb94 Mon Sep 17 00:00:00 2001 From: Huluti Date: Sun, 5 Feb 2017 11:15:04 +0100 Subject: [PATCH] Fix language detection --- src/manjaro_hello.py | 7 ++++--- ui/manjaro-hello.glade | 16 ++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/manjaro_hello.py b/src/manjaro_hello.py index 6dd15d7..d7c8075 100644 --- a/src/manjaro_hello.py +++ b/src/manjaro_hello.py @@ -113,7 +113,10 @@ class ManjaroHello(): sys_locale = locale.getdefaultlocale()[0] # If user's locale is supported if os.path.isfile(path.format(sys_locale)): - return sys_locale + if "_" in sys_locale: + return sys_locale.replace("_", "-") + else: + return sys_locale # If two first letters of user's locale is supported (ex: en_US -> en) elif os.path.isfile(path.format(sys_locale[:2])): return sys_locale[:2] @@ -125,8 +128,6 @@ class ManjaroHello(): :param locale: locale to use :type locale: str """ - if "_" in locale: - locale = locale.replace("_", "-") try: tr = gettext.translation(self.app, self.locale_path, [locale], fallback=True) tr.install() diff --git a/ui/manjaro-hello.glade b/ui/manjaro-hello.glade index 259f617..9bbec99 100644 --- a/ui/manjaro-hello.glade +++ b/ui/manjaro-hello.glade @@ -465,27 +465,27 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we Arabic Catalan - Chinese (China) - Chinese (Taiwan) + Chinese (China) + Chinese (Taiwan) Czech Dutch English French German - Greek (Greece) + Greek (Greece) Hungarian Italian Lithuanian Polish - Portuguese (Brazil) - Portuguese (Portugal) + Portuguese (Brazil) + Portuguese (Portugal) Russian - Slovenian (Slovenia) + Slovenian (Slovenia) Slovenian Spanish - Serbian (Serbia) + Serbian (Serbia) Serbian - Turkish (Turkey) + Turkish (Turkey) Turkish