From 37213d55f87edafc72ae28a0ee00673e5d081f1a Mon Sep 17 00:00:00 2001 From: Huluti Date: Sat, 14 Jan 2017 15:04:30 +0100 Subject: [PATCH] Fix bug which prevents certain languages from being loaded https://forum.manjaro.org/t/start-work-on-a-new-welcome-screen-manjaro-hello/13685/281?u=huluti --- launch.sh | 5 +++-- src/manjaro_hello.py | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/launch.sh b/launch.sh index 1136588..bdc5b33 100755 --- a/launch.sh +++ b/launch.sh @@ -5,8 +5,9 @@ rm -rf locale mkdir locale cd po for lang in $(ls *.po); do - mkdir -p ../locale/${lang::-3}/LC_MESSAGES - msgfmt -c -o ../locale/${lang::-3}/LC_MESSAGES/manjaro-hello.mo $lang + lang=${lang::-3} + mkdir -p ../locale/${lang//_/-}/LC_MESSAGES + msgfmt -c -o ../locale/${lang//_/-}/LC_MESSAGES/manjaro-hello.mo $lang.po done cd .. python src/manjaro_hello.py diff --git a/src/manjaro_hello.py b/src/manjaro_hello.py index 3e1129a..2ce0637 100644 --- a/src/manjaro_hello.py +++ b/src/manjaro_hello.py @@ -126,6 +126,8 @@ 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()